2025-04-29 5:08 AM - last edited on 2025-04-29 5:59 AM by mƎALLEm
hi i have a system with two flash memories, one nor and one nand. i need a filesystem supported especially for the nand. which one can i use? are there any examples of support?
2025-04-29 10:16 AM - edited 2025-04-29 10:16 AM
Hello @Giovanni3,
The reference FatFs applications within the STM32CubeF7 firmware packages are based on the hardware memory resources available on STM32F7 boards. The available resources include uSD, USBDisk, and RAMDisk memories, but no NAND memory is available.
However, you can customize the diskio.c/.h
files to interface with any specific memory.
Here's a simplified example of how you might set up the disk I/O interface for FatFs:
#include "ff.h" // FatFs header
#include "diskio.h" // Disk I/O header
#include "nand_driver.h" // Your NAND flash driver header
DSTATUS disk_initialize(BYTE pdrv) {
if (nand_init() == NAND_OK) {
return RES_OK;
}
return STA_NOINIT;
}
DRESULT disk_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count) {
if (nand_read(sector, buff, count) == NAND_OK) {
return RES_OK;
}
return RES_ERROR;
}
DRESULT disk_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) {
if (nand_write(sector, buff, count) == NAND_OK) {
return RES_OK;
}
return RES_ERROR;
}
With Regards,
Anis