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.

PROCESSOR-SDK-AM437X: QSPI flash device data

Part Number: PROCESSOR-SDK-AM437X

Hi experts,

I am referring to pdk_am437x_1_0_15, subfolder .\packages\ti\starterware\device.
Using qspi_flash.c for an alternate board with Micronix N25Q256A flash device,
I called the function QSPIFlashGetDeviceData(). I always get an error caused
by NULL pointer returning from that function.

While debugging I found that variable devIndex is incremented double
(once within FOR iteration, and in addition after comparing values).
This can't be correct - right?

Regards, Thomas

  • Hi Thomas,

    I need to investigate this, I'll get back with you shortly.

    Regards,
    Frank

  • Hi Thomas,

    Can you please confirm you're referring to the code below?

    qspiFlashDeviceData_t *QSPIFlashGetDeviceData(uint32_t devId)
    {
        uint32_t numDev = sizeof(gQspiFlashDeviceData) / sizeof(qspiFlashDeviceData_t);
        uint32_t devIndex = 0U;
        qspiFlashDeviceData_t *flashDeviceData = NULL;
    
        for (devIndex = 0U; devIndex < numDev; devIndex++)
        {
            if (devId == gQspiFlashDeviceData[devIndex].devId)
            {
                /* Device Found */
                flashDeviceData = &gQspiFlashDeviceData[devIndex];
                break;
            }
            devIndex++;
        }
        return flashDeviceData;
    }

    Yes, the increment of devIndex inside the for() loop seems like a bug. I'll take this up with the development team and get back with you concerning the response I get.

    Regards,
    Frank

  • Hi Frank,

    Yes, it's the code part from your screenshot.

    The device identification works if devIndex++ is removed but programming the N25Q256A QSPI flash fails.

    It looks like some commands are different (e.g. FULL_ERASE, read MFG_ID) between MX66L512 and N25Q256A.

    And I am wondering if access to lock registers or unlocking sectors has to be added prior to programming!?

    Regards, Thomas

  • Hi Thomas,

    I filed a bug report for the extra index increment in the for() loop. Thanks much for pointing this out.

    I suppose access to lock registers & sectors depends on the device.

    Regards,
    Frank