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.

TMDS243GPEVM: Flash read ID fails

Part Number: TMDS243GPEVM
Other Parts Discussed in Thread: SYSCONFIG

I am using the TMDS243GPEVM development board with mcu_plus_sdk_am243x_08_02_00_31. The function Flash_norXspiReadId() fails to read the correct part ID for the OSPI Flash part. According to the infineon/Cypress Datasheet for the S28HS512TGABHM010 NOR flash part, there are six bytes returned for the manufacturer and device ID. The Flash_norXspiReadId() function gets bytes 2, 3, and 4, which are the Device ID LSB, the ID Length, and the Physical Sector Architecture; bytes 0, 1 and 5 are missing. The function Flash_norXspiReadId() is interpreting these three byte values as the Manufacturer ID (byte 0), the Device ID MSB (byte 1), and the Device ID LSB (byte 2). Line number 1024 of ospi_v0.c is returning the results of the read ID command, and it is returning the last 4 bytes of the ID rather than the first 4 bytes of the ID.

Paul Hanson

  • Hi Paul,

    I have assigned this thread to flash expert. You should be hearing from him soon. 

    Regards,

    Prasad

  • Hi Paul,

    I see similar behavior for the first call to Flash_norXspiReadId() in Flash_norXspiOpen(). In my case, the first read returns Bytes 1,2,3 of the Manufacturer and Device ID.

    However, I notice Flash_norXspiReadId() is called in a loop in Flash_norXspiOpen():

            /* Set dummyCycles in OSPI controller and corresponding latencyCode to flash */
            Flash_norXspiSetDummyCycles(config);
            uint32_t readDataCapDelay = 4U;
            OSPI_setRdDataCaptureDelay(obj->ospiHandle, readDataCapDelay);
            status = Flash_norXspiReadId(config);
    
            while((status != SystemP_SUCCESS) && (readDataCapDelay >= 0U))
            {
                readDataCapDelay--;
                OSPI_setRdDataCaptureDelay(obj->ospiHandle, readDataCapDelay);
                status = Flash_norXspiReadId(config);
            }
    

    The OSPI Read Delay (see TRM, Table 12-3229. OSPI_RD_DATA_CAPTURE_REG Register Field Descriptions) is set to 4 for the first call to Flash_norXspiReadId(). While Flash_norXspiReadId() continues to fail, the delay is decremented until it reaches 0. If Flash_norXspiReadId() passes, it indicates the Manufacterer ID and Device ID have been properly read.

    This is the data I see in the flash configuration data structure after the data is properly read:

    Please let me know if this answers the question.

    Regards,
    Frank

  • Frank,

    Note that the variable readDataCapDelay is defined as an unsigned variable. It is decremented in the the while loop, which compares it to being greater than or equal to zero. Unsigned variables cannot be less than zero. Therefore, what you have is an infinite loop if Flash_norXspiReadId() fails, which is what I am experiencing.

    I am testing this on the TMDS243GPEVM board, so why is Flash_norXspiReadId() failing? Why does it not return the first two bytes of the part ID?

    Paul

  • Hi Paul,

    what you have is an infinite loop if Flash_norXspiReadId() fails, which is what I am experiencing.

    This seems like a bug. There is the infinite loop issue and I don't see any handling for the case the IDs aren't properly read. I'll discuss this with the SW development team.

    so why is Flash_norXspiReadId() failing? Why does it not return the first two bytes of the part ID?

    I'm following up with internal experts on this. In the meantime, can you try:

    1. Changing readDataCapDelay type to int32_t to avoid the infinite loop issue -- see what happens in this case when the loop exists.
    2. Increasing the readDataCapDelay initial value to something higher than 4? -- see if the IDs are properly read with a larger max value.

    Regards,
    Frank

  • Frank,

    I have fixed the infinite loop, and I have increased the number of loops. Neither change resolved the bad read of the ID.

    Paul

  • Hi Paul,

    Thanks for the feedback. I'm consulting with internal experts and will keep you posted.

    Regards,
    Frank

  • Frank,

    Good idea on the flash diagnostics. I ran them, and it returned the correct manufacturer/device IDs, and all tests passed.

    I compared the sysconfig OSPI settings between our project and the diagnostics project. Our project has enable dual transfer rate enabled. I will turn this off and see what happens.

    Thanks,

    Paul

  • Frank,

    Removing the enable of dual transfer rate cured the problem. I believe it was enabled by default.

    Thanks,

    Paul