This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWRL6432: qspiflash mmap

Part Number: IWRL6432

Dear TI experts,

It seems iwrl6432 qpiflash driver doesn't have QFI function like 18xx/68xx Gen1, and there is no mmap read/write API in present mcu-plus SDK5104 either.

In Gen1 18xx/68xx, we can store  customize parameters in nor flash and use mmap read them to avoid waste data RAM,

and read these parameters base on mapping address (0xc0000000 in Gen1 SoC) within offset, it smells good.

Present mcu-plus sdk5104 shows only basical read/write/erase APIs,

Neither finding info about iwrl6432 support QFI function nor understanding Cortex-m4f Cache support qspiflash mapping.

My Question is : Does iwr6432 support qspiflash memory mapping mode?

  • Hi,

    Can you elaborate a bit on exactly what functionality you are looking for? While the functions are not identical between IWRL6432 and previous devices, there is support for memory mapped mode in the QSPI driver, which can be found by searching for "mapped" in qspi.c. However, I presume this is insufficient for what you are looking for, so if you could help provide additional details, that would be helpful.

    Best Regards,
    Alec

  • Hi Alec,

    In previous 18xx/68xx, qspiflash driver,

    We can use any write function to a certain sector, assuming here is a 16M bits (2M Bytes) capacity flash, "writing" is always known to be annoying.
    Say I want to write some information to keep at last block first sector(mapped address = 0xC01F0000). for eaxmple such a structure of data.

    typedef struct{
    
    //these fields are not important, just for example
    uint32_t dirty;
    uint8_t BootPartition;
    uint8_t DefaultProfileIndex;
    int32_t boardMode;
    UART_Params UartParams[2];
    
    ...
    }Config, *pConfig;
    
    Config myConfig;
    //assignment for config...
    myConfig.dirty = 0xDEADBEEF;
    myConfig.DefaultProfileIndex = 0;
    ...

    Write myConfig by something like:

    QSPIFlash_sectorErase(QSPIFlashHandle, 0xC01F0000);
    QSPIFlash_singleWrite(QSPIFlashHandle, 0xC01F0000, sizeof(Config), (uint8_t*)&myConfig);

    then, we can set flash to mmap read mode:

    QSPIFlash_configMmapRead(QSPIFlashHandle, FLASH_AUTO_MODE, &errCode);

    after this, 0xC0000000~0xC0200000 mapped to flash for read,

    I can compare structured direct read without consuming additional data ram.

    For example on 18xx/68xx:

    pConfig myMappedConfig = 0xC01F0000;
    if(myMappedConig->dirty != 0xDEADBEEF)
    {
        SetupDefaultConfig();
    }
    else
    {
        //Start working according to config settings
        ...
    }

    with L6432, I have no idea to do similar thing,

    I just can use to declare structure space in stack, and read it to.

    Config myConfig;
    Flash_read(QSPIFlashHandle, 0x1F0000, &readBuf, sizeof(Config));
    if(myConfig.dirty != 0xDEAFBEEF)
    {
    ...
    }
    else
    {
    ...
    }

    of cause, it will still work, but it just doesn't smell good.

    The consumption of flash space and RAM space is almost 1:1.

    The more you use flash to store parameters which need to be read, the more unfavorable for precious RAM.

    So, I'm looking for similar mmap read function to L6432 SDK.

  • Hi Brian,

    Thank you for explaining your issue in more detail. I was able to reach out and get a more detailed answer for you. 

    You should be able to use the "QSPI_setMemAddrSpace" API to switch to the memory mapped mode and then read from 0x70000000 + Size of the flash.

    Thank you,

    Angie

  • Thank you so much~Angie,

    I observed that after the read and write operations of SDK5104, the mode will be set back to mmap port, even no need to call "QSPI_setMemAddrSpace()", just read, but thank you for telling me the mapping position of 0x70000000, I really don’t know here, but now I know it's defined as "CSL_APP_QSPI_EXT_FLASH_U_BASE".

    I try to print contents of flash by offset and size, work gracefully~

    uint8_t *ptr;
    ptr = (uint8_t *)(CSL_APP_QSPI_EXT_FLASH_U_BASE + offset);
    for(uint32_t i = 0; i < size; i++)
    {
        if(i%16 == 0)
            CLI_write("\r\n[%6X]", ptr);
    
        CLI_write("%2X ", *ptr++);
    }
    CLI_write("\r\n");