Hi All,
I am trying to implement MFS on flashx memory, attached is my code.
I am able to write file and if I search for files in MFS it return me the file details.
But when I read the file it returns me 0 bytes in file and I am not able to read file.
Can anyone please suggest me the corrections I need to do.
Thanks and Regards,
Rahul
Original Attachment has been moved to: mfs_demo.c.zip
Solved! Go to Solution.
Hi Rahul,
I tested your code at my TWR-K21F120M board.
fseek(filePtr, 0, IO_SEEK_END);
i = ftell(filePtr);
fseek(filePtr, 0, IO_SEEK_SET);
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
BTW: The MFS is not intended to be used on a flash memory without a wear leveling layer (as FAT table is frequently updated, the internal flash could wear out due to too many Program/Erase cycles).
If you use MFS mainly for read and your application writes to MFS only seldom, you can forget on wear leveling. But if your application updates MFS frequently you will need wear leveling layer in software. You will need to develop a software, which sits between MFS and flashx driver and which spreads the program/erase load of the internal flash sectors equally. (By the way, common use case of MFS on SD card employs wear leveling algorithms inside the SD card itself)...
Hi Radek,
Thanks for your reply, yes this is correct I could able to do that with little debugging and was about to post my comment :-). I am aware of wear leveling issue, but as my system needs one time write and then read only so I guess this should be fine.
Thanks,
Rahul
Hi Rahul,
I tested your code at my TWR-K21F120M board.
fseek(filePtr, 0, IO_SEEK_END);
i = ftell(filePtr);
fseek(filePtr, 0, IO_SEEK_SET);
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------