Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

File System Help

I have a system where I can make a linked list of a data structures that contain some 32-bit numbers. The main software uses these linked lists as sort of points on a curve where the hardware uses logic to connect the dots in a linear fashion. These data structures are the main part of the system. Some systems will create, edit, and delete these structures more than other systems so I need something that can potentially handle a lot of wear.  


For the time being I have just been allowing 1 sector of an EPCS64 chip to be used as user data. This means anytime I make a small change I'm copying the sector to a buffer making changes to it, and then erasing the entire 64KBytes and then writing the updated buffer back. This seems like a very good way to lower the lifespan of the chip. I'm guessing on average possibly 20 updates a day. 


I've also been asked to give the ability in the future for users to make these list structures, or more complicated ones, using some customized software. We want them to be able to send them from a PC to the FPGA board like a copy paste function. 


Would the best way to achieve this functionality be using a FAT file system? Also, should I switch over to a SPI mode MMC card for the storage, or will the EPCS device be adequate?
0 Kudos
2 Replies
Honored Contributor I

A FAT filesystem won't help the wear - if anything it will make it worse since the diectory and FAT structures need updating as well as the data. 


I'm not 100% sure of the EPCS64 chips, some flash chips have a sector erase (to all 1's) and allow writes to individual words to clear bits. There is no requirement to do all the writes at once. 


So you can write the 'new' data further down the 64k sector (into an area that is still 0xff), then clear some bits of the header of the old data to mark it invalid. The erase then only need be done when you are getting near the end of the flash sector. 


I've that technique for 'environment' data - a 32 bit word held 3 bytes tag + 1 byte length (in words). Write sequence was: 0xffffff | length, data, tag | length, 0 | old_length (over old tag).
Honored Contributor I

I'm leaning towards the MMC/SD option because of the high cost of the EPCS chips anyways, and the fact that I won't have to rewrite a bunch of FATFS drivers.  


Most of the Altera examples only support read only file systems using the EPCS devices so I figure they're not really meant to be used in this way. 


EDIT: I misread your statement. That would essentially work, but would require an adapter application on the computer side to handle formatting the data into something that could bridge between the two systems.