What's issue make you can't use SmartFS/LittleFS/SPIFFS directly on MT29F4G08? From my experience, there isn't much difference between NAND flash and NOR flash if the hardware can do ECC correction automatically.
None of those can be used with NAND. All of them assume that they can write individual bytes in the '1' state to the '0' All of them will modify the FLASH in that way. That then breaks the ECC. With NAND, you can only write a whole page with all of the ECC bits in place. You cannot modify the FLASH page after that because it will break the ECC.
All of those file systems, I believe, will modify FLASH in that
way and, hence, cannot be used with NAND.
d. does someone have other working solutions for nand flash filesystem ?SmartFS/LittleFS/SPIFFS/NXFFS is designed for the flash storage in mind, all of them is bultin supported by NuttX, why not try they first?
I don't know about LittleFS, but I guarantee that SmartFS, SPIFF,
and NXFFS will not work on NAND. It took me a day of debugging to
understand why. SmartFS, modifies wear leveling bits in FLASH and
cannot be used with NAND. I have tried NXFFS and it
hello
I want to discuss about the nand flash and filesystem support. I turned into nuttx because
I have a linux background and RTOS like freertos is most likely a bare OS kernel ,porting
exist things is annoying such as filesystem and POSIX interface etc.
Some introduction of my situation and motivation:
I'm trying to do porting the Nuttx onto the alientek apollo STM32F429 board.
It's their website:
http://www.alientek.com
Their development board is very hot here in China, but it's a pity the website is in Chinese Language only.
I worked based onstm32f429i-disco and what I have done:
a.uart
b.external sdram
c.led
all works fine. Next step I want to get the Nand flash working with some filesystem. Nand flash is Micron
MT29F4G08.I realized that nuttx have no filesystem for nand on the shelf and the exist filesystem have to
do some changes to fit nand flash.I want a more mature filesystem which I can think of from linux
is something based on mtd like jiffs2 or YAFFS2.Maybe ubifs is better but It's not based on the mtd and more complex.
I choosed YAFFS2 In fact the porting to Nuttx is pretty easy after I decided to port YAFFS2 with its direct mode.
Next step I configured the FMC and got the FMC talk to nand correctly. Later I choose to use the driver file
mtd_nand.c later I find I have to implement the method in the nand_raw.h for the lowest talking to nand in
order to get all filesystem software stack working. I have a pause here and looking forward to your advice
for such topics:
a. Could I benefit from Linux as I don't want to reinvent the wheel ? what can I do to minium the effort ? Can we have a better sturcture?
b. Should I put the raw_nand method drivers/mtd/ or the board specific folder?I think I should put in the mtd folder for micron specific
c. license of YAFFS2 is GPL which would pollute the nuttx BSD license, what is your advice? I have to link it with library format ?
d. does someone have other working solutions for nand flash filesystem ?
e. As I understand, the raw nand filesystem is always a big headache for many rtos, if you don't choose linux you only have very
limited options for free use, FAT is a obvious option but you have to working on the FTL level by yourself. It is meaningful to
choose raw nand for low cost electronic product other than sd-card competitable storgage.
What's your opinion ?
Best
I see from the first reference that ArmMbed refers to the Dhara FTL as a related project. THAT is what you need for NAND integration and was mentioned earlier in this thread: "Dhara - An interesting NAND flash translation layer designed for small MCUs. It offers static wear-leveling and power-resilience with only a fixed O(|address|) pointer structure stored on each block and in RAM." https://github.com/ARMmbed/littlefs/blob/master/README.md
With Dhara, NAND can be used with any file system. Without an NAND FTL, NAND cannot be used at all.
There are few other references to NAND:
"littlefs by itself does not provide ECC." https://github.com/ARMmbed/littlefs/blob/master/DESIGN.md
Those two paragraphs above are the only to references in the documents you site. On refers to Dhara which we should also be considering, the other just states that littlefs does NOT support ECC. There no no other reference to NAND.
Better information... basically LittleFS does not have NAND
support and AFAIK it has never been used it with NAND. Per
https://github.com/ARMmbed/littlefs/issues/11, littlefs does
appear to support bad block management and wear leveling. But I
quote:
LittleFS has only been used on NOR flash, eMMC, SD cards; devices with <4KB erase units, so I'm not sure how it will perform on NAND flash.
Concerns:
You must provide ECC
LittleFS will hand write errors, which is the main effect of flash wear. But with NAND memory you also have to worry about read errors. NAND memory is so dense that the stored electrons start misbehaving pretty easily.
Scanning the MT29F's datasheet, it looks like that part has built in ECC you can use.
On disk, each file uses 1 erase unit at minimum.
For 128KiB erase units, this may waste a large amount of space.
But NAND devices are also very large, so if you have few files this may not be a problem? I'm not sure. It probably depends a lot on how you use the filesystem.
I have plans to improve this issue by storing multiple files in a block, but I don't know when I'll be able to implement the idea. So unfortunately at the moment 1 file per erase unit is the best LittleFS can do.
You may need 2KiB (writable unit) of RAM for the program cache?
I'm not sure if you can take advantage of the 1 byte sequential writes.
For each block, LittleFS does write the data out sequentially. But, it may partially write to multiple erase units multiple times (for example, partially write erase unit A, partially write erase unit B, finish writing erase unit A). Can the NAND chip handle that sort of pattern?
At the moment, I think LittleFS might need a flash translation layer (FTL) to be efficient. An FTL would provide a smaller erase unit and prevent all of the issues, though you may still want to use LittleFS for power resilience.
At the very least, LittleFS is probably better than putting FAT directly on top of raw NAND.
If you do try to put LittleFS on a NAND chip, let me know how it goes! I'd be interested to know what sort of problems you run into.
And
My hope is to avoid using a fully featured FTL layer such as dhara (https://github.com/dlbeer/dhara),
Greg
> To unsubscribe from this group and stop receiving emails from it, send an email to nu...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "NuttX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nuttx+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nuttx/0fb5d486-2431-4654-9c7b-3126e857f081%40googlegroups.com.