AnsweredAssumed Answered

FatFs with nor flash memory MIMXRT1062

Question asked by T. Y. on Feb 17, 2020
Latest reply on Feb 19, 2020 by jeremyzhou

Hello,

 

On my custom board has QSPi flash for which I have to read / write via FatFS file system.

So, I'm trying to combine fsl_flexspi_nor_flash.c with FatFS diskio.c with reference to sdcard_fatfs of "SDK_2.7.0_EVK-MIMXRT1060".

However, I realized that f_mkdir failed, and that these were not enough to update certain pages.

Are there any SDKs or documentation available to help you update a specific page in a sector of Nor Flash memory?

Or tell me if there is another good way.

 

DRESULT nor_disk_write(uint8_t physicalDriveconst uint8_t *bufferuint32_t sectoruint8_t count)
{
    uint8_t writeCount;
    assert(count == 1U);

    if (physicalDrive != NORDISK)
    {
        return RES_PARERR;
    }

    /* Write according to fatfs sector size */
    for(writeCount = 0; writeCount < FF_MAX_SS / nor_Handle.bytesInPageSize; writeCount++)
    {
        if (Nor_Flash_Page_Program(&nor_Handle, (sector * FF_MAX_SS) + ( nor_Handle.bytesInPageSize * writeCount ), buffer + (nor_Handle.bytesInPageSize * writeCount)) < 0)
        {
            return RES_ERROR;
        }
    }
    return RES_OK;
}

 

Hardware Details
Board ;EVK-MIMXRT1060
Device :MIMXRT1062
SDK Details
SDK Version :2.7.0 (released 2019-12-19)
Host OS :Windows
Toolchain :IAR Embedded Workbench for ARM
Middleware  :FatFS, sdmmc stack
Reference
SDK_2.7.0_EVK-MIMXRT1060\middleware\fatfs
SDK_2.7.0_EVK-MIMXRT1060\boards\evkmimxrt1064\sdmmc_examples\sdcard_fatfs
SDK_2.7.0_EVK-MIMXRT1060\components\flash\nor\flexspi\fsl_flexspi_nor_flash.c

Outcomes