SlideShare une entreprise Scribd logo
1  sur  14
What you should know about Flash
Storage
2
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.
Flash types: Raw Flash vs Managed Flash
Currently, Toradex computer modules used NOR, NAND, and eMMC flash.
NOR and NAND are raw storage devices. The main difference between NAND and NOR is that NOR allows
random access, doesn’t need error correction as well as has higher cost-per-bit. NAND on the other side
can only be read in pages, some bits in a page may be wrong and need to be corrected by an error
correction mechanism.
3
eMMC Flash combines NAND memory with a built-in controller that handles most of the nasty 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 on the flash type used on our computer modules;
4
Evolution of NAND Flash: From SLC to MLC
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 Multi Level Cell (MLC), flash can store two or more
bits per cell, so the bit density gets increased. Sounds great but with MLC there are downsides as well: with
MLC NAND, comes also a higher bit error rate and lower endurance. All eMMC use MLC NAND. Some of the
eMMC devices allow you to switch into a pseudo-SLC (PSLC) mode on parts of (or) all the storage. This will
reduce the size of the storage whereas the endurance of the device gets increased.
5
Here is a rough comparison of SLC and MLC.
Endurance: Limited amount of erase cycles
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.
6
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 block. In a
worst case, this means that if you only want to write one single byte, you potentially have to erase and write one
whole block. The block size can be up to 512 KB. The effect of erasing / writing more than you actually want is
called write amplification. May be, there are even additional write operations needed by the flash file system. If
you want to estimate the lifetime of the flash storage on your embedded device, you should take that into
consideration.
Increase lifetime of flash
The following section shows how the lifetime of NAND or eMMC flash can be improved. Don’t worry,
all these things are already handled by Toradex, there is no need for any action on your side.
7
Prevent wearing: Wear leveling
Let’s assume you are aware of the fact, that flash can be erased / written only a limited number of times and you only
update small amounts of data periodically. If this data would be written always to the same flash cell you could only
write max.15K times on MLC flash. While you have never touched all the other flash cells, your data could get lost and
the flash is broken as the cells you have been writing to are worn out. Smart flash drivers use wear leveling. This
technique ensures that all flash cells are worn similarly and not always the same cells are used.
Detect and correct errors: Error correction Codes
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 less errors can be
detected and corrected.
8
Bad block handling
As ECCs enables us to find erroneous blocks, we can stop using these bad blocks any longer. Depending on the ECC and
the amount of bits that can corrected, a threshold is set that defines the maximal number of errors that are accepted
before further action is taken. Once we reach this threshold, the data gets corrected and is moved to a good block on
the device. The previous location is marked as bad. Bad blocks are not used any longer as they are potentially broken.
Power fail tolerance
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.
9
Implementation Details on Toradex SoMs
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.
NAND-based devices
The following figure gives you a generic overview on the setup of our WinCE and Linux BSPs on NAND based devices.
10
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 device specific PDD layer on
WinCE.
Flash Translation Layer: This layer is responsible for wear leveling and bad block management. On
Linux, this is done by the UBI subsystem; while on WinCE, it is done by the Microsoft MDD layer. Again,
on the Colibri T20, we use a device specific layer and not the Microsoft Flash MDD.
11
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 trough the VFS layer). On Linux, we use currently UBI FS; while on
WinCE, Transaction Save exFAT (TexFAT). Both are power-cut tolerant. The underlying layers are power-cut tolerant
as well by supporting atomic operations.
eMMC-based devices
The following table shows the setup using the Toradex System on Modules using eMMC flash devices.
12
Storage device: Compared to the raw NAND, most magic is done by the eMMC itself. Higher layers do not have to take
care of wear leveling, error correction or bad block management.
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.
13
Conclusion and Recommendations
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 with the write behavior, 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.
Thank you

Contenu connexe

En vedette

Why Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT StrategyWhy Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT Strategy
andreas kuncoro
 
SAMSUNG Exynos Mobile AP
SAMSUNG Exynos Mobile APSAMSUNG Exynos Mobile AP
SAMSUNG Exynos Mobile AP
JJ Wu
 
Qualcomm Snapdragon 600-based SmartPhone
Qualcomm Snapdragon 600-based SmartPhoneQualcomm Snapdragon 600-based SmartPhone
Qualcomm Snapdragon 600-based SmartPhone
JJ Wu
 
Smartphone Market Trends
Smartphone Market TrendsSmartphone Market Trends
Smartphone Market Trends
Justin Lee
 
Smart Phone in 2013
Smart Phone in 2013Smart Phone in 2013
Smart Phone in 2013
JJ Wu
 
AMD 2014 Mobility APU Lineup Announcement
AMD 2014 Mobility APU Lineup AnnouncementAMD 2014 Mobility APU Lineup Announcement
AMD 2014 Mobility APU Lineup Announcement
AMD
 

En vedette (18)

Why Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT StrategyWhy Software Defined Storage is Critical for Your IT Strategy
Why Software Defined Storage is Critical for Your IT Strategy
 
Ceph Day Taipei - Ceph on All-Flash Storage
Ceph Day Taipei - Ceph on All-Flash Storage Ceph Day Taipei - Ceph on All-Flash Storage
Ceph Day Taipei - Ceph on All-Flash Storage
 
SAMSUNG Exynos Mobile AP
SAMSUNG Exynos Mobile APSAMSUNG Exynos Mobile AP
SAMSUNG Exynos Mobile AP
 
Webinar: How NVMe Will Change Flash Storage
Webinar: How NVMe Will Change Flash StorageWebinar: How NVMe Will Change Flash Storage
Webinar: How NVMe Will Change Flash Storage
 
Qualcomm Snapdragon 600-based SmartPhone
Qualcomm Snapdragon 600-based SmartPhoneQualcomm Snapdragon 600-based SmartPhone
Qualcomm Snapdragon 600-based SmartPhone
 
Q4.11: Next Gen Mobile Storage – UFS
Q4.11: Next Gen Mobile Storage – UFSQ4.11: Next Gen Mobile Storage – UFS
Q4.11: Next Gen Mobile Storage – UFS
 
Samsung galaxy s6 edge review
Samsung galaxy s6 edge reviewSamsung galaxy s6 edge review
Samsung galaxy s6 edge review
 
Introducing Apple iPhone 6s
Introducing Apple iPhone 6sIntroducing Apple iPhone 6s
Introducing Apple iPhone 6s
 
Azure IoT Hub on a Toradex Colibri VF61 – Part 1 - Sending data to the cloud
Azure IoT Hub on a Toradex Colibri VF61 – Part 1 - Sending data to the cloudAzure IoT Hub on a Toradex Colibri VF61 – Part 1 - Sending data to the cloud
Azure IoT Hub on a Toradex Colibri VF61 – Part 1 - Sending data to the cloud
 
2016 Flash Storage-NVMe Brand Leader Mini-Report
2016 Flash Storage-NVMe Brand Leader Mini-Report2016 Flash Storage-NVMe Brand Leader Mini-Report
2016 Flash Storage-NVMe Brand Leader Mini-Report
 
Introducing Google Pixel XL
Introducing Google Pixel XLIntroducing Google Pixel XL
Introducing Google Pixel XL
 
Q4.11: Introduction to eMMC
Q4.11: Introduction to eMMCQ4.11: Introduction to eMMC
Q4.11: Introduction to eMMC
 
Apple MacBook 2016
Apple MacBook 2016Apple MacBook 2016
Apple MacBook 2016
 
2016 Enterprise Flash Storage Buyer Behavior
2016 Enterprise Flash Storage Buyer Behavior2016 Enterprise Flash Storage Buyer Behavior
2016 Enterprise Flash Storage Buyer Behavior
 
Smartphone Market Trends
Smartphone Market TrendsSmartphone Market Trends
Smartphone Market Trends
 
OpenStack vs VMware vCloud
OpenStack vs VMware vCloudOpenStack vs VMware vCloud
OpenStack vs VMware vCloud
 
Smart Phone in 2013
Smart Phone in 2013Smart Phone in 2013
Smart Phone in 2013
 
AMD 2014 Mobility APU Lineup Announcement
AMD 2014 Mobility APU Lineup AnnouncementAMD 2014 Mobility APU Lineup Announcement
AMD 2014 Mobility APU Lineup Announcement
 

Plus de Toradex

Plus de Toradex (20)

Toradex Strengthens Custom Solutions Offering with Acquisition of Linear Comp...
Toradex Strengthens Custom Solutions Offering with Acquisition of Linear Comp...Toradex Strengthens Custom Solutions Offering with Acquisition of Linear Comp...
Toradex Strengthens Custom Solutions Offering with Acquisition of Linear Comp...
 
プレスリリース:ToradexがJapan IT Week【春】2024年に出展
プレスリリース:ToradexがJapan IT Week【春】2024年に出展プレスリリース:ToradexがJapan IT Week【春】2024年に出展
プレスリリース:ToradexがJapan IT Week【春】2024年に出展
 
Introducing Aquila: The Next Generation Toradex SoM Family
Introducing Aquila: The Next Generation Toradex SoM FamilyIntroducing Aquila: The Next Generation Toradex SoM Family
Introducing Aquila: The Next Generation Toradex SoM Family
 
Join Toradex at Japan IT Week Spring 2024
Join Toradex at Japan IT Week Spring 2024Join Toradex at Japan IT Week Spring 2024
Join Toradex at Japan IT Week Spring 2024
 
Toradex announces Titan Eval Kit w/ NXP's i.MX 95 - Early Access Program
Toradex announces Titan Eval Kit w/ NXP's i.MX 95 - Early Access ProgramToradex announces Titan Eval Kit w/ NXP's i.MX 95 - Early Access Program
Toradex announces Titan Eval Kit w/ NXP's i.MX 95 - Early Access Program
 
ToradexがJapan IT Week【春】2023年に出展
ToradexがJapan IT Week【春】2023年に出展ToradexがJapan IT Week【春】2023年に出展
ToradexがJapan IT Week【春】2023年に出展
 
NXP Semiconductors elevates Toradex to Platinum Partner status
NXP Semiconductors elevates Toradex to Platinum Partner statusNXP Semiconductors elevates Toradex to Platinum Partner status
NXP Semiconductors elevates Toradex to Platinum Partner status
 
Webinar: Secure Offline and Online Updates for Linux Devices
Webinar: Secure Offline and Online Updates for Linux DevicesWebinar: Secure Offline and Online Updates for Linux Devices
Webinar: Secure Offline and Online Updates for Linux Devices
 
Toradex opens office in Tokyo, reaffirming its growth strategy in the Asia-Pa...
Toradex opens office in Tokyo, reaffirming its growth strategy in the Asia-Pa...Toradex opens office in Tokyo, reaffirming its growth strategy in the Asia-Pa...
Toradex opens office in Tokyo, reaffirming its growth strategy in the Asia-Pa...
 
Toradex launches Verdin featuring NXP i.MX 8M Mini/Nano SoMs
Toradex launches Verdin featuring NXP i.MX 8M Mini/Nano SoMsToradex launches Verdin featuring NXP i.MX 8M Mini/Nano SoMs
Toradex launches Verdin featuring NXP i.MX 8M Mini/Nano SoMs
 
Ethernet Compliance Testing at Toradex
Ethernet Compliance Testing at ToradexEthernet Compliance Testing at Toradex
Ethernet Compliance Testing at Toradex
 
Webinar On-demand: Introducing the new Colibri SoM based on the NXP i.MX 6ULL...
Webinar On-demand: Introducing the new Colibri SoM based on the NXP i.MX 6ULL...Webinar On-demand: Introducing the new Colibri SoM based on the NXP i.MX 6ULL...
Webinar On-demand: Introducing the new Colibri SoM based on the NXP i.MX 6ULL...
 
Starting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 ProcessorsStarting with OpenCV on i.MX 6 Processors
Starting with OpenCV on i.MX 6 Processors
 
Cloud-Aided Yocto Build Speedup
Cloud-Aided Yocto Build SpeedupCloud-Aided Yocto Build Speedup
Cloud-Aided Yocto Build Speedup
 
Toradex Global Video Montage
Toradex Global Video MontageToradex Global Video Montage
Toradex Global Video Montage
 
Considerations on usage of Computer on Modules for Applications inside Emerge...
Considerations on usage of Computer on Modules for Applications inside Emerge...Considerations on usage of Computer on Modules for Applications inside Emerge...
Considerations on usage of Computer on Modules for Applications inside Emerge...
 
Customizable Embedded 3D Surround View Turn-Key Solution on Apalis iMX6 SoM
Customizable Embedded 3D Surround View Turn-Key Solution on Apalis iMX6 SoMCustomizable Embedded 3D Surround View Turn-Key Solution on Apalis iMX6 SoM
Customizable Embedded 3D Surround View Turn-Key Solution on Apalis iMX6 SoM
 
288 Core ARM® and 13’824 CUDA Core Microserver Cluster with Toradex Apalis Sy...
288 Core ARM® and 13’824 CUDA Core Microserver Cluster with Toradex Apalis Sy...288 Core ARM® and 13’824 CUDA Core Microserver Cluster with Toradex Apalis Sy...
288 Core ARM® and 13’824 CUDA Core Microserver Cluster with Toradex Apalis Sy...
 
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
 
Developing Real-Time Systems on Application Processors
Developing Real-Time Systems on Application ProcessorsDeveloping Real-Time Systems on Application Processors
Developing Real-Time Systems on Application Processors
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

What you should know about Flash Storage

  • 1. What you should know about Flash Storage
  • 2. 2 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. Flash types: Raw Flash vs Managed Flash Currently, Toradex computer modules used NOR, NAND, and eMMC flash. NOR and NAND are raw storage devices. The main difference between NAND and NOR is that NOR allows random access, doesn’t need error correction as well as has higher cost-per-bit. NAND on the other side can only be read in pages, some bits in a page may be wrong and need to be corrected by an error correction mechanism.
  • 3. 3 eMMC Flash combines NAND memory with a built-in controller that handles most of the nasty 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 on the flash type used on our computer modules;
  • 4. 4 Evolution of NAND Flash: From SLC to MLC 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 Multi Level Cell (MLC), flash can store two or more bits per cell, so the bit density gets increased. Sounds great but with MLC there are downsides as well: with MLC NAND, comes also a higher bit error rate and lower endurance. All eMMC use MLC NAND. Some of the eMMC devices allow you to switch into a pseudo-SLC (PSLC) mode on parts of (or) all the storage. This will reduce the size of the storage whereas the endurance of the device gets increased.
  • 5. 5 Here is a rough comparison of SLC and MLC. Endurance: Limited amount of erase cycles 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.
  • 6. 6 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 block. In a worst case, this means that if you only want to write one single byte, you potentially have to erase and write one whole block. The block size can be up to 512 KB. The effect of erasing / writing more than you actually want is called write amplification. May be, there are even additional write operations needed by the flash file system. If you want to estimate the lifetime of the flash storage on your embedded device, you should take that into consideration. Increase lifetime of flash The following section shows how the lifetime of NAND or eMMC flash can be improved. Don’t worry, all these things are already handled by Toradex, there is no need for any action on your side.
  • 7. 7 Prevent wearing: Wear leveling Let’s assume you are aware of the fact, that flash can be erased / written only a limited number of times and you only update small amounts of data periodically. If this data would be written always to the same flash cell you could only write max.15K times on MLC flash. While you have never touched all the other flash cells, your data could get lost and the flash is broken as the cells you have been writing to are worn out. Smart flash drivers use wear leveling. This technique ensures that all flash cells are worn similarly and not always the same cells are used. Detect and correct errors: Error correction Codes 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 less errors can be detected and corrected.
  • 8. 8 Bad block handling As ECCs enables us to find erroneous blocks, we can stop using these bad blocks any longer. Depending on the ECC and the amount of bits that can corrected, a threshold is set that defines the maximal number of errors that are accepted before further action is taken. Once we reach this threshold, the data gets corrected and is moved to a good block on the device. The previous location is marked as bad. Bad blocks are not used any longer as they are potentially broken. Power fail tolerance 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.
  • 9. 9 Implementation Details on Toradex SoMs 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. NAND-based devices The following figure gives you a generic overview on the setup of our WinCE and Linux BSPs on NAND based devices.
  • 10. 10 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 device specific PDD layer on WinCE. Flash Translation Layer: This layer is responsible for wear leveling and bad block management. On Linux, this is done by the UBI subsystem; while on WinCE, it is done by the Microsoft MDD layer. Again, on the Colibri T20, we use a device specific layer and not the Microsoft Flash MDD.
  • 11. 11 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 trough the VFS layer). On Linux, we use currently UBI FS; while on WinCE, Transaction Save exFAT (TexFAT). Both are power-cut tolerant. The underlying layers are power-cut tolerant as well by supporting atomic operations. eMMC-based devices The following table shows the setup using the Toradex System on Modules using eMMC flash devices.
  • 12. 12 Storage device: Compared to the raw NAND, most magic is done by the eMMC itself. Higher layers do not have to take care of wear leveling, error correction or bad block management. 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.
  • 13. 13 Conclusion and Recommendations 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 with the write behavior, 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.