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.

AM2634: Long timeout in Flash_norQspiWaitReady

Part Number: AM2634

Hi TI team!
We observed an issue in Flash_norQspiWaitReady function where very long timeout or issue with reading, which could sometimes lead to system freezing.

        if((readStatus & devCfg->srWip) == 0)
        {
            break;
        }

this read status returns 35 from SPI_DATA_REG 

SDK version mcu_plus_sdk_am263x_08_05_00_24

Could you please help us how to fix this issue. 

Regards!

  • Hi Oleg,

    Looks like your flash part has hung. You are not able to read back anything from the flash before/after you issue the erase command.

    Best Regards,
    Aakash

  • Hi Aakash!

    1. So, do you think it could be a hardware issue?

    2. If 1st yes, can we perform a flash reset via software? How can we do it in the correct way?

    3. I observed in mcu_plus_sdk_am263x_09_01_00_41 this part of the code was patched (see diff file from flash_nor_qspi.c). May I ask why? Did you observe any issue related to mcu_plus_sdk_am263x_08_05_00_24?

    4. We use Flash same as on Launch Pad, did you observe any HW issues with it?

    Diff:

    diff --git a/./mcu_plus_sdk_am263x_08_05_00_24__all/mcu_plus_sdk_am263x_08_05_00_24/source/board/flash/qspi/flash_nor_qspi.c b/./mcu_plus_sdk_am263x_09_01_00_41__all/mcu_plus_sdk_am263x_09_01_00_41/source/board/flash/qspi/flash_nor_qspi.c
    index 05a8f91..bb67f43 100644
    --- a/./mcu_plus_sdk_am263x_08_05_00_24__all/mcu_plus_sdk_am263x_08_05_00_24/source/board/flash/qspi/flash_nor_qspi.c
    +++ b/./mcu_plus_sdk_am263x_09_01_00_41__all/mcu_plus_sdk_am263x_09_01_00_41/source/board/flash/qspi/flash_nor_qspi.c
    @@ -1,5 +1,5 @@
     /*
    - *  Copyright (C) 2021 Texas Instruments Incorporated
    + *  Copyright (C) 2021-23 Texas Instruments Incorporated
      *
      *  Redistribution and use in source and binary forms, with or without
      *  modification, are permitted provided that the following conditions
    @@ -448,7 +448,7 @@ static int32_t Flash_norQspiSetProtocol(Flash_Config *config, Flash_Params *para
                 }
             }
     
    -        if(SystemP_SUCCESS == status)
    +        if((SystemP_SUCCESS == status) && (protocol <= FLASH_CFG_PROTO_1S_1S_4S))
             {
                 QSPI_setRxLines(obj->qspiHandle, gFlashToSpiProtocolMap[protocol]);
             }
    @@ -646,10 +646,16 @@ static int32_t Flash_norQspiErase(Flash_Config *config, uint32_t blkNum)
     
         uint8_t  cmd = QSPI_CMD_INVALID_OPCODE;
         uint32_t cmdAddr = QSPI_CMD_INVALID_ADDR;
    +    uint32_t eraseTimeout = devCfg->flashBusyTimeout;
     
         if (blkNum == (uint32_t)(-1))
         {
             cmd    = devCfg->eraseCfg.cmdChipErase;
    +        /* Chip erase times can be several minutes and can vary from flash to
    +         * flash. Give UINT_MAX so that we wait for as much time it takes to
    +         * erase the flash completely.
    +         */
    +        eraseTimeout = (uint32_t)(-1);
         }
         else
         {
    @@ -669,10 +675,6 @@ static int32_t Flash_norQspiErase(Flash_Config *config, uint32_t blkNum)
             }
         }
         if(status == SystemP_SUCCESS)
    -    {
    -        status = Flash_norQspiWaitReady(config, devCfg->flashBusyTimeout);
    -    }
    -    if(status == SystemP_SUCCESS)
         {
             status = Flash_norQspiCmdWrite(config, devCfg->cmdWren, QSPI_CMD_INVALID_ADDR, 0, NULL, 0);
         }
    @@ -686,7 +688,7 @@ static int32_t Flash_norQspiErase(Flash_Config *config, uint32_t blkNum)
         }
         if(status == SystemP_SUCCESS)
         {
    -        status = Flash_norQspiWaitReady(config, devCfg->flashBusyTimeout);
    +        status = Flash_norQspiWaitReady(config, eraseTimeout);
         }
     
         return status;
    @@ -701,10 +703,16 @@ static int32_t Flash_norQspiEraseSector(Flash_Config *config, uint32_t sectorNum
     
         uint8_t cmd = QSPI_CMD_INVALID_OPCODE;
         uint32_t cmdAddr = QSPI_CMD_INVALID_ADDR;
    +    uint32_t eraseTimeout = devCfg->flashBusyTimeout;
     
         if(sectorNum == (uint32_t)(-1))
         {
             cmd = devCfg->eraseCfg.cmdChipErase;
    +        /* Chip erase times can be several minutes and can vary from flash to
    +         * flash. Give UINT_MAX so that we wait for as much time it takes to
    +         * erase the flash completely.
    +         */
    +        eraseTimeout = (uint32_t)(-1);
         }
         else
         {
    @@ -724,10 +732,6 @@ static int32_t Flash_norQspiEraseSector(Flash_Config *config, uint32_t sectorNum
             }
         }
         if(SystemP_SUCCESS == status)
    -    {
    -        status = Flash_norQspiWaitReady(config, devCfg->flashBusyTimeout);
    -    }
    -    if(SystemP_SUCCESS == status)
         {
             status = Flash_norQspiCmdWrite(config, devCfg->cmdWren, QSPI_CMD_INVALID_ADDR, 0, NULL, 0);
         }
    @@ -741,7 +745,7 @@ static int32_t Flash_norQspiEraseSector(Flash_Config *config, uint32_t sectorNum
         }
         if(SystemP_SUCCESS == status)
         {
    -        status = Flash_norQspiWaitReady(config, devCfg->flashBusyTimeout);
    +        status = Flash_norQspiWaitReady(config, eraseTimeout);
         }
     
         return status;

    Regards!

  • Hi Oleg,

    Do you still see this issue ? Does your AM263x syscfg for 09.01 is similar or exactly same to the one you use on your custom hardware ?

    Did it work for AM263x 08_05 release and not for 09_01 release (just to rule out hardware issue) ?

    Best Regards,
    Aakash