UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant jsara
Participant
1,267 Views
Registered: ‎08-14-2015

emmc reliable write on zynq

Jump to solution

Reliable write is a feature of the emmc flash chip on picozed (and perhaps other) Zynq related boards.

 

Does anyone know if the flash file system (bare metal) supports reliable write features?

Objective is to occasionaly write small amounts of data to the flash (e.g basic configuration info) and not have a corrupted file system due to power failure.

Can someone provide any hints on how to achieve this - that is to occasionally write to the flash but still maintain file system integrity in the case of an unanticipated power failure.

0 Kudos
1 Solution

Accepted Solutions
1,188 Views
Registered: ‎01-08-2012

Re: emmc reliable write on zynq

Jump to solution

Search online for images of (enterprise quality) SSD teardowns.  You'll be able to clearly see the banks of capacitors used for reserve power to allow any Flash operations to complete as the power fails.  I included some images at the bottom of this post.

 

One possible sequence of events is as follows:

  1. The input power supply starts to fail.  This is detected by some hardware somewhere.
  2. This sends an interrupt to the CPU.  The OS turns this into a message to its memory subsystem.
  3. The memory subsystem sends a message to the Flash controller, which clears its work queue, waits for any current erase or program operations to finish (which may take a few ms), then asserts the write protect input on the nand Flash.

All that did was ensure that no nand erase or program operation was cut short by the power failure.  It does not mean that every write() or sync() actually saved to the Flash, or even that the filesystem is viable.

System level integrity will require a journalling filesystem (or equivalent) to recover from that sort of thing.  When power is restored, it will replay the journals and hopefully recover a working filesystem.  The eMMC will do that internally, using some proprietary filesystem with proprietary software that you will not be able to review for correctness.

 

 

This is the part where you look at the schematic of your hardware and you realise that, whilst the bullet point in the glossy brochure said it had power loss protection, the hardware designer didn't actually include early power fail detection or any reserve power source, nor did the kernel hackers provide any support in the operating system.

Nevertheless, you might get lucky in practice and not brick your board.  Good luck.

 

 

EDIT: you might get some hints from this old comp.dsp thread.  In particular:

  • you might be able to set your eMMC into pSLC mode (which only stores 1 bit per MLC cell, reducing the capacity but improving the reliability)
  • you should use a journalling filesystem.
  • you can keep multiple copies of critical files.  (Stagger the writes so that at most one will be affected by power loss.)
  • you can add extra integrity checks on your critical files.

StorageReview-Kingston-SSDNow-E100-Enterprise-SSD-PCB-Bottom.jpeg

 m500-mSATA-Back.jpeg

View solution in original post

3 Replies
1,189 Views
Registered: ‎01-08-2012

Re: emmc reliable write on zynq

Jump to solution

Search online for images of (enterprise quality) SSD teardowns.  You'll be able to clearly see the banks of capacitors used for reserve power to allow any Flash operations to complete as the power fails.  I included some images at the bottom of this post.

 

One possible sequence of events is as follows:

  1. The input power supply starts to fail.  This is detected by some hardware somewhere.
  2. This sends an interrupt to the CPU.  The OS turns this into a message to its memory subsystem.
  3. The memory subsystem sends a message to the Flash controller, which clears its work queue, waits for any current erase or program operations to finish (which may take a few ms), then asserts the write protect input on the nand Flash.

All that did was ensure that no nand erase or program operation was cut short by the power failure.  It does not mean that every write() or sync() actually saved to the Flash, or even that the filesystem is viable.

System level integrity will require a journalling filesystem (or equivalent) to recover from that sort of thing.  When power is restored, it will replay the journals and hopefully recover a working filesystem.  The eMMC will do that internally, using some proprietary filesystem with proprietary software that you will not be able to review for correctness.

 

 

This is the part where you look at the schematic of your hardware and you realise that, whilst the bullet point in the glossy brochure said it had power loss protection, the hardware designer didn't actually include early power fail detection or any reserve power source, nor did the kernel hackers provide any support in the operating system.

Nevertheless, you might get lucky in practice and not brick your board.  Good luck.

 

 

EDIT: you might get some hints from this old comp.dsp thread.  In particular:

  • you might be able to set your eMMC into pSLC mode (which only stores 1 bit per MLC cell, reducing the capacity but improving the reliability)
  • you should use a journalling filesystem.
  • you can keep multiple copies of critical files.  (Stagger the writes so that at most one will be affected by power loss.)
  • you can add extra integrity checks on your critical files.

StorageReview-Kingston-SSDNow-E100-Enterprise-SSD-PCB-Bottom.jpeg

 m500-mSATA-Back.jpeg

View solution in original post

Participant jsara
Participant
1,163 Views
Registered: ‎08-14-2015

Re: emmc reliable write on zynq

Jump to solution

Thanks for the detailed reply.  It seems unfortunate that the built in Xilinx bare metal SDK is so poor on flash support.  It does support a FAT file system set of utilities but is missing a fat file system repair tool like fsck.  And for embedded applications which this is targeted to, the file system should have some robustness which these utilities do not appear to support.

 

I see a third party set of tools threadx, netx, filex, seems to have good file system support but its really expensive and I don't see much traffic on these forums about anyone using it?

0 Kudos
1,142 Views
Registered: ‎01-08-2012

Re: emmc reliable write on zynq

Jump to solution

I've never used Xilinx's bare metal SDK, so I can't really comment on that.

FAT ought to work though, as the eMMC itself will use journalling internally.  I've heard that some eMMC devices will assume you are using FAT and internally mirror certain sectors (that are critical for FAT) for better reliability.

 

Also, please note that my earlier post was about "enterprise level" reliability.  If you are only interested in "hobbyist level" reliability you'll most likely be fine without doing anything special, other than minimising writes to the eMMC.

0 Kudos