Skip to main content
Visitor II
April 29, 2025
Question

File system support on MT29F1G NAND Flash with STM32F7

  • April 29, 2025
  • 1 reply
  • 567 views

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?

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    April 29, 2025

    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.

    Example Code Snippet

    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

     

    Giovanni3Author
    Visitor II
    April 30, 2025

    Hi. yes, i realized that, but how do i manage erase of blocks and modifying a file created in fat?

    Technical Moderator
    May 14, 2025

    @Giovanni3 wrote:

    Hi. yes, i realized that, but how do i manage erase of blocks and modifying a file created in fat?


    This can be done using FATFS API.