OLinuXino boards now are used at many different places and environments. Few days ago we got call from customer who is using A13-OLinuXino-WIFI in industrial applications and have installations all around the world including China 🙂 His industrial controller is running on Android and his problem is that randomly from time to time the Android NAND image gets corrupted. We also have noticed on our forum posts that some boards have NAND flash corrupted and need to be re-flashed. Usually we blame for the NAND corruption the cheap power supplies used, but this customer assured me that he is using very good, industrial power supply with all noise protections etc.
With our engineers we decided to do some extensively tests on this subject and here are the results:
1. It’s very important the power supply to stay ON uninterrupted while Android boots, for freshly programmed image this may take SEVERAL minutes as obviously when run for very first time Android creates lot of files and buffers.
After the first boot the Android usually starts faster for less than minute after you apply power supply (and it is not put in mode for start with POWER key).
What we found is that if the power supply is interrupted while Android boots it almost 100% sure that NAND will be corrupted. In 9 of 10 times when we power off board while boots NAND gets corrupted.
This is usually critical part for non-patient and non-experienced users I guess, they plug TV and power supply and wait few seconds – nothing happen on the TV and they power off the board – now already NAND is corrupted!
2. After Android boot is complete and power is switched off, there is rare but still chance to kill your NAND content. We try and out of 1 of 50 switch ON/OFF NAND will be corrupted, what we guess is that Android even after boot from time to time write files to NAND file system and if you hit such time slot to power off your board your NAND will be corrupted.
OK we start thinking how to avoid this, first we though it would be clever to add brown-out protection circuit which to disable NAND write (Write Protect) when glitch on power supply is detected.
Unfortunately (and logically) this made things even worse, now even when you plug USB device or when you enable/disable LCD backlight small glitch on the power supply disables the NAND write, but the processor is working and what happens when processor is running and try to write file while NAND is disabled – MESS!
Reading our forum we saw suggestion how correctly to power off Android device, using this command sequence:
$ sync $ reboot -p
and cut power after these commands execution finish, we didn’t manage to corrupt the NAND flash even after hundreds of power on/off cycles this way.
The conclusion, the one and only correct way to power OFF OLinuxino running Android/Linux is by executing above commands and after them to cut power off, otherwise there is always chance processor to start write to file system and if power is cut at this point NAND Flash will be corrupted.
Experiments with SD cards show that they are much more reliable to such power interruptions. Probably because they have their own internal Flash write controller.