Hi All,
I have read the documentation and scoured the forum but (!) I am still unsure whether Keil provides a solution for FAT filesystem + SPI NAND.
FAT FS + NAND, yes I see that and FAT FS + SPI SD Card, yes I see that also, but not FAT FS + SPI NAND.
Can anyone quickly and easily clarify this one for me?
Regards
Andy
There is no direct driver support for SPI NAND, but if you are able to write a NAND driver (http://www.keil.com/support/man/docs/rlarm/rlarm_fs_cfgnand.htm) for your SPI NAND device there should be no problem using it.
Which SPI NAND device is meant to be used?
Hi Vladimir,
Thanks for the update. The documentation does not appear clear to me in this regard (or have I not read the 'important bit(s)'?).
The flash device we are using is Micron MT29F4G01.
What you're suggesting sounds valid to me and was what I was considering as the only path forward - basically make the SPI device look like a regular NAND device and under the hood, do what's necessary to translate between the two. I hope I am not trivialising what turns out to be a complex task.
It is just as "simple" as you said :)
Page Read/Write and Erase Block functions need to be implemented and in addition, if internal ECC in MT29F4G01 will be used, NAND page layout must be adjusted. According to datasheet, it must be done like this:
static void SetupPageLay (NAND_DRV_CFG *cfg) { NAND_PG_LAY *pgLay = cfg->PgLay; /* According to MT29F4G01 datasheet, page 36 */ if (cfg->PageSize == 2112) { /* Setup page layout */ pgLay->Pos_BBM = 0; /* Bad block data */ pgLay->Pos_LSN = 2; /* Logical sector number */ pgLay->Pos_COR = 6; /* Data corrupted marker */ pgLay->Pos_ECC = 8; /* ECC data */ pgLay->SectInc = 512; /* Byte address increment till next sector */ pgLay->SpareOfs = 2048; /* Byte address of the first spare */ pgLay->SpareInc = 16; /* Byte address increment till next spare */ } }
If internal ECC logic won't be used, you must enable ECC in software through the File_Config.c and then there is no need to adjust page layout - flash translation layer will take the default settings.