Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedded System and Serial Flash wear issues

Tags:

embedded

I am using a serial NOR flash (SPI Based) for my embedded application and also I have to implement a file system over it. That makes my NOR flash more prone to frequent erase and write cycles where having a wear level Algorithm comes into picture. I want to ask few questions regarding the same:

First, is it possible to implement a Wear Level Algorithm for Nor flash, if yes then why most of the time I find the solutions for NAND Flash and not NOR Flash?

Second, are serial SPI based low cost NAND flashes available, if yes then kindly share the part number for the same.

Third, how difficult is it to implement our own Wear Level algorithm?

Fourth, I have also read/heard that industrial grade NOR Flashes have higher erase/write cycles (in millions!!), is this understanding correct? If yes then kindly let me know the details of such SPI NOR Flash, which may also lead to avoiding implementation of wear level algorithm, if not completely then since I'm planning to implement my own wear level algorithm, it might give me a little room and ease in certain areas to implement the wear level algorithm.

The constraint to all these point is cost, I would want to have low cost solution to these issues.

Thanks in Advance

Regards

Aditya Mittal

([email protected])

like image 638
user1986379 Avatar asked Jan 17 '13 08:01

user1986379


1 Answers

Implementing a wear-levelling algorithm is is not trivial, but not impossible either:

  1. Your wear-levelling driver needs to know when disk blocks are no longer used by the filing system (this is known as TRIM support on modern SSDs). In practice, this means you need to modify your block driver API and filing systems above it, or have the wear-levelling driver aware of the filing system's free-space map. This second option is easy for FAT, but probably patented.

  2. You need to reserve at least an erase-unit + a few allocation units to allow erase unit recycling. Reserving more blocks will increase performance

  3. You'll want a background thread to perform asynchronous erase-unit recycling

  4. You'll need to test, test an test again. When I last built one of these, we built a simulation of both flash and ran the real filing system on top it, and tortured the system for weeks.

  5. There are lots and lots of patents covering aspects of wear-leveling. By the same token, there are two at least two wear-levelling layers in the Linux Kernel.

Given all of this, licensing a third-party library is probably cost-effective,

like image 176
marko Avatar answered Oct 14 '22 23:10

marko