0
votes

I'm trying to integrate FATFS file system on Micron NAND SPI FLASH. I'm using the SPI peripheral of the STM32L486RG as interface.

I have developped a low level driver through which I'm able to read, write and erase data from different locations in the NAND memory. I have then integrated my Low-level driver APIs under diskio.c file in order they could be used by fatfs APIs.

I have successfully formatted the memory through f_mkfs (I'm getting FR_OK with both f_mkfs and f_open APIs and when debugging the fs object is containing the FAT signature).

However, when I try to write buffer into the file that I have created using f_oprn , I get "FR_INT_ERR" .

I have debugged my code step by step and I found that my get_fat function returns (1) as result which means that an internal error has occurred .

Any idea what could be the issue ?

1

1 Answers

1
votes

I guess you need to erase the memory's sector you mean to write in - even though you write per pages and not per entire sector - and that's why using FatFs becomes tricky in NAND Flash.

Since your purpose is to bound the logical drive to the entire physical drive, you need to use the option ( FM_SDF | FM_ANY ) for the parameter opt into the f_mkfs function to format the memory.