Many modern embedded devices depend on NAND flash memory for data storage and operation. NAND (Negated AND) is referred to as the same silicon logic gate technology used in eMMC, SSD, Compact Flash, and form factor variants of SD, such as micro SD flash memory. In this post I cover basics of micro SD cards because they are the most portable, widely available, and used in many embedded devices as well as micro PCs currently on the market. A common misconception is that all flash memory is equally reliable, which often leads to choosing the most cost-effective and highest storage capacity card. I think software engineers, diy’ers, and practitioners in the field need to understand the variable dependability of this technology. Device operation failure can result from compromised software due to corrupt or defective memory.
There are a few things you should know when choosing a micro SD card for your custom device, or buying an off-the-shelf device with a micro SD card inside. NAND flash technology is pretty complicated, and I will not be covering a lot of the details here. I just want to present you with some basic information you should consider when choosing a micro SD card for your project.
What are micro SD cards?
Micro SD cards are basically a NAND-type flash chip and a tiny microcontroller in a small, portable package. NAND-type flash memory can be written and read in blocks/pages, one drawback being that it can only take a certain amount of write cycles per block/page. The flash chip is where the blocks of storage exist and the microcontroller is used to access and perform error corrections, wear leveling and bad-block control. This algorithm in the microcontroller can increase the number of write cycles (aka endurance cycles) and the overall life of the flash, but it is not standard to all flash memory cards. Because of their compact size, micro SD cards use different microcontrollers than SSD or eMMC flash, which tend to be the more reliable but less portable NAND flash option (usually soldered or permanently installed).
One of the main goals of flash manufacturers has been to reduce the cost per bit and increase maximum storage capacity in order to compete against traditional magnetic storage such as HDD. The most common question about micro SD cards is: “How do they become larger in storage capacity, but remain at the same physical size?” Well, the short answer is that manufacturers make the NAND geometry smaller and pack more bits per cell, which also means that there is less space between bits. This is where the reliability factor comes in. Just like with everything else in engineering, you don’t get something for nothing, and there is always a sacrifice.
What are the different types?
Looking up micro SD cards can be tough and some of these technical details are not outlined in the glossy brochure. There are a ton of little symbols on these things and as the technology improves in performance, new standards are issued, usually depicted by a new symbol on the card. You really need to know your application requirements beforehand. There are a lot of micro SD cards out there tailored for specific applications, or even for specific devices. Some will have faster read/write speeds than others, some will withstand a higher range of temperature, shock, water, and other extreme conditions of operation. These are all important, but the main differentiator in reliability is the NAND geometry also referred to as cell size/sector size or trace width. Small NAND geometry means small sector size, small sector size means there is less space between data bits. Less space between bits allows manufacturers to offer higher storage capacity in the same form factor, but it can cause serious issues such as sector cross-talk, read disturb, data corruption, and ultimately unreadable memory. These issues are usually caused by unexpected events such as abrupt power loss while writing to a sector on the card for example. This may not so bad if your micro SD is only used for data storage – you lost historical data, but if you are running your Operating System on the micro SD card, your whole system may be compromised.
There are a few types of NAND. I listed them here in order of most reliable first:
SLC – Single Level Cell, 1-Bit/Cell, large geometry, 2 voltage states to represent 0 and 1, difficult to obtain as a user and very expensive.
pSLC – Pseudo SLC, MLC in 1-Bit/Cell Mode, medium geometry, 2 voltage states to represent 0 and 1, easier to obtain and more affordable than SLC.
MLC – Multi Level Cell, 2-Bit/Cell, small geometry, requires 4 voltage states to represent 00, 01, 10 and 11, easy to obtain and very affordable.
TLC – Tri Level Cell , 3-Bit/Cell, very small geometry, requires 8 voltage states to represent 3-bits 000, 001, 010, 011, 100, 101, 110 and 111, easy to obtain, but please stay away from this type. I personally would not install this type of card even in my camera, my vacation pictures are worth something to me.
QLC – new technology on the horizon, not available yet. 4-bit/Cell…
How should I choose?
- NAND geometry – as a controls guy this is really the first thing I look at before I go on and look at the rest of the card specs. If you are choosing a micro SD card for an automation/control device, this is the first spec you should be looking at too. This is also the most costly spec. It is really difficult and expensive to obtain SLC NAND in micro SD form factor (SDHC / SDXC), especially as a consumer/enthusiast. SLC is usually available in Compact Flash or SSD form factor. SLC is so expensive in micro SD form factor, that manufacturers will go to eMMC chips before they put one of these cards in a device. MLC NAND should really only be used for consumer devices such as cameras, smart phones, etc. Where the behavior of reads/writes is easily predictable and the Operating System is not running in the micro SD card. TLC is so unreliable that I am not even going to discuss it here, and I recommend staying away. This leaves us with the best and most affordable NAND option in micro SD form factor – the pSLC. Pseudo SLC NAND provides a good middle ground. Even though it is based on MLC geometry, it is set in 1-bit/cell mode which really makes a difference. I created a little graphic for comparison pictured above. You can see that the middle relative sector size rectangle (bright green pSLC) is very similar in size to MLC and TLC, but the bit spacing is significantly different. pSLC is the type of card I chose for my embedded device or micro PC systems.
- CAPACITY – this is the most basic parameter and it is pretty straight forward. Choose the capacity which will fit your application and leave you some room for operation and future updates. If the device trends data, calculate the maximum space you can use on the card (total card size minus your installed application size) before you have to purge old data, ultimately purging old data should happen automatically in software.
- SPEED – this parameter is important, but unless you are buying a very inexpensive micro SD card, most modern cards from reputable manufacturers will have pretty good read/write speeds. For good speeds, you should be looking at “Class 10″or or “U3” symbols indicated on the card. This performance metric is also dependent on your host device.
- ENDURANCE/ WRITE CYCLES – this will vary from different manufacturers, and again the NAND geometry will come into play here. Simply look for cards which state “high endurance” which will usually denote MLC and TLC. These numbers are not scientific, but if I had to give you some rough estimation, an SLC will give you about 50K+ cycles, a pSLC card will give you 20K+ and MLC or TLC only about 1K.
- RANGE OF OPERATION – this is difficult to prove, so a lot of times you have to take the manufacturer’s word on the spec and do some testing of your own to “qualify” the card for your application. Most embedded device applications are 0-60°C, but wide temperature operation, water and shock proof cards are also available. If your application is really extreme or mission-critical, you should probably not be using a micro SD card of any type, but eMMC or SSD instead.
The bottom line is that you really want to go for a pSLC micro SD card for your embedded automation device or micro PC. Just the fact that it is pSLC NAND-type flash covers a lot of the other important specs and then all you have to worry about is capacity and maybe range of operation. I always go for pSLC cards from reputable manufacturers. I have personally done extensive tests where I randomly and abruptly power cycle an embedded device literally thousands of times while writing some data to the card periodically. The worst I have seen with pSLC is some recent data loss, but never failure. I currently have a Raspberry Pi3 with a pSLC card which has randomly rebooted over 5,000 times running BASpi-IO software in Raspbian Stretch. It is still working and it is still power cycling!
Please comment if you have any questions. I would love to hear about your experience with micro SD cards or other flash storage.