Getting SFDP parameters from QSPI NOR flash using ROMAPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting SFDP parameters from QSPI NOR flash using ROMAPI

917 Views
mastupristi
Senior Contributor I

Hi,

I have MIMXRT1020-EVK (rev A3). It is populated with IS25LP064A-JBLE.

I would like to try to read SFDP parameters using the ROM API.

I read the documentation (both IS25LP064A datasheet and JESD216)

mastupristi_0-1746461024385.png

 

mastupristi_1-1746461144247.png

 

For this I modified the example evkmimxrt1020_fsl_romapi (which I have attached), to run in RAM and not to write flash.

Specifically, I added an entry in the LUT (I used the symbol NOR_CMD_LUT_SEQ_IDX_READ_SFDP that was already defined in fsl_romapi.h)

    /* Read SFDP */
    config->memConfig.lookupTable[4U * NOR_CMD_LUT_SEQ_IDX_READ_SFDP] =
        FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x5AU, RADDR_SDR, FLEXSPI_1PAD, 0x18U);
    config->memConfig.lookupTable[4U * NOR_CMD_LUT_SEQ_IDX_READ_SFDP + 1U] =
        FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 0x08U, READ_SDR, FLEXSPI_1PAD, 0x04U);

you can see that it's very similar to the read command.

 

Then I defined the function to do SFDP transactions.

status_t FLEXSPI_NorFlash_sfdp(uint32_t instance, uint32_t addr, uint32_t *readData, size_t readDataLen)
{
    flexspi_xfer_t xfer;
    xfer.operation            = kFLEXSPIOperation_Read;
    xfer.seqId                = NOR_CMD_LUT_SEQ_IDX_READ_SFDP;
    xfer.seqNum               = 1U;
    xfer.baseAddress          = addr;
    xfer.isParallelModeEnable = false;
    xfer.rxBuffer             = readData;
    xfer.rxSize               = readDataLen;

    uint32_t status = ROM_FLEXSPI_NorFlash_CommandXfer(instance, &xfer);
    return status;
}

 

This call, however, returns code 6001, which should mean Invalid Sequence:

mastupristi_2-1746461912919.png


Where am I going wrong? How to make SFDP reading work?

best regards

Max

Tags (3)
0 Kudos
Reply
2 Replies

878 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @mastupristi ,

Thanks for your interest in NXP MIMXRT series!

I used something similar to FLEXSPI_NorFlash_GetVendorID() to create a lut_seq, and update it with ROM_FLEXSPI_NorFlash_UpdateLut(), and this method performs a successful read of the SFDP header.

You can try it on your end. I hope it helps you!

Best regards,
Gavin

0 Kudos
Reply

865 Views
mastupristi
Senior Contributor I

Hi @Gavin_Jia 

Oh, brilliant – I just discovered that if manually overwrite the LUT in the hardware, everything starts working:

static status_t flash_sfdp(uint32_t addr, uint32_t *readData, size_t readDataLen)
{
    uint32_t lut_seq[4];
    memset(lut_seq, 0, sizeof(lut_seq));
    // Read SFDP
    lut_seq[0] = FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x5AU, RADDR_SDR, FLEXSPI_1PAD, 0x18U);
    lut_seq[1] = FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 0x08U, READ_SDR, FLEXSPI_1PAD, 0x04U);
    ROM_FLEXSPI_NorFlash_UpdateLut(0, NOR_CMD_LUT_SEQ_IDX_READ_SFDP, (const uint32_t *)lut_seq, 1U);

    flexspi_xfer_t xfer;
    xfer.operation            = kFLEXSPIOperation_Read;
    xfer.seqId                = NOR_CMD_LUT_SEQ_IDX_READ_SFDP;
    xfer.seqNum               = 1U;
    xfer.baseAddress          = addr;
    xfer.isParallelModeEnable = false;
    xfer.rxBuffer             = readData;
    xfer.rxSize               = readDataLen;

    uint32_t status = ROM_FLEXSPI_NorFlash_CommandXfer(0, &xfer);
    return status;
}

So let me get this straight: you ask us to fill out a lookupTable array in the flexspi_nor_config_t struct, but the ROM API never even reads it? Totally intuitive design choice!

I mean, since you’ve already blessed us with half a dozen other fields in flexspi_nor_config_t that apparently exist solely for ornamental value, I guess my next step is to guess which ones actually do something? What else am I supposed to try—perform a rain dance?

At this point, can someone point me to the magical incantation that makes these “config” fields actually… you know, get used? Or should I just start writing my own ROM API to interpret hieroglyphics?

best regards

Max

0 Kudos
Reply