What you should know about Flash storage
The flash storage is often a topic on our support channels. Toradex invests a lot of resources into making the storage as reliable as possible. Nevertheless, it is important to understand some basics of the underlying storage device. One of the most important things you have to know is that if the storage wears out, you can destroy your storage device by writing a lot to the built-in storage device. With this post, we want to give you a basic overview of potential issues flash storage can have. Let’s start with a short technology overview first.
Currently, Toradex computer modules used NOR, NAND, and
NOR and NAND
eMMC Flash combines NAND memory with a built-in controller that handles most of the things you have to take care of when dealing with NAND flash. eMMC is also called managed NAND. With NAND and NOR flash on the other side, the OS and device drivers are responsible to handle these issues. We will discuss the different kinds of challenges later in this blog post.
Here is a small overview
||Toradex Computer Module
|NAND||Colibri PXA310, PXA320, VF50, VF61, iMX7, T20|
|EMMC||Colibri iMX6 and T30, Apalis iMX6, T30 and TK1|
The bit density on NAND flash has evolved over time. First NAND devices were Single Level Cell (SLC) flash. This means every flash cell stores one single bit. With
Here is a rough comparison of SLC and MLC.
|Bits per Cell||1||2 and more (TLC)|
|Erase/Program cycles||100K||3K to 15K|
|Minimal ECC, bits correctable
per 512 Bytes, chip dependent
|8 bit||12 bit|
|Cost per Byte||Higher||Lower|
As already mentioned, one of the most important things you have to know about any flash technology used on our devices is that you can write and erase flash only a limited number of times. Writing huge amounts of data to the flash device is not a good idea! As shown in the table above, depending on the type of flash you have between 100K and 10K erase cycles available before the data potentially gets corrupted or lost. The term “erase cycles” is irritating. One limitation of flash storage is, that it cannot be rewritten without being erased before. Further on, this cannot be done at the bit level but only at bigger chunks called erase block. In
The following section shows how the lifetime of NAND or
Let’s assume you are aware of the fact, that flash can be
On a NAND flash device, it can happen that single bits start flipping and your data could get corrupted. This can either be due to wearing or any other disturbance. Therefore, the data is secured by Error Correction Codes (ECC). This allows first to detect corrupted data and second to correct the data. Depending on the Flash Controller and the NAND / eMMC flash itself, more or
As ECCs enables us to find erroneous blocks, we can stop using these bad blocks any longer. Depending on the ECC and the
What happens to your device in case of a sudden power loss while writing to the flash? On embedded devices, you expect that the device still boots properly and your data did not get corrupted. To reach that, all software layers and hardware parts involved have to be capable of handling such a situation. You find some more details in the next section on how we reach that goal.
As seen above, having a proper setup depending on the underlying storage type is crucial. Let’s go into the details of the current setup you on the Toradex BSPs.
The following figure gives you a
Storage device: On all our devices using NAND, we use SLC NAND.
Hardware Driver: The hardware driver offers a generic interface between the NAND device and the upper layers. This layer is also responsible to detect and correct errors. On Linux, all our current images use MTD. On WinCE, we use the Microsoft Flash PDD layer. There are some exceptions such as Colibri T20, where we use a
Wear leveling and
Filesystem: The file system is actually the part that manages the partitions and the files stored in them. A user will use the file API to use the file system (on Linux
The following table shows the setup using the Toradex Modules using eMMC flash devices.
Storage device: Compared to the raw NAND, most magic is done by the
Hardware Driver: This is the interface between the MMC controller and the file system.
Filesystem: As for the NAND based devices on WinCE, here also we use TexFAT; our Linux Images use the ext3 filesystem. Again, both are power-cut tolerant.
Toradex does its best to provide reliable and enduring flash storage. Nevertheless, you should always keep an eye on flash usage during application development.
- Reduce write access to the flash device
- Know the write behavior of your final product
- Check if
withthe writebehavior, the requested lifetime of your product is feasible or not
- Run stress tests and longtime tests
- Not using the full capacity greatly improves the efficiency of wear leveling algorithms
If you need any further information or you think we could improve our default setup, please get in contact with our engineers.
We also produced a webinar regarding Flash Memory in Embedded Linux Systems:#eMMC #Flash Memory #NAND #NOR
Leave a comment
Your email ID will be kept confidential. Required fields are marked *
* Your comment will be reviewed and then added. Thank you.