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.

AWR1843BOOST: MCU stuck in ROM bootloader

Part Number: AWR1843BOOST
Other Parts Discussed in Thread: AWR1843

Hi, We use QSPI Flash to emulate EEPROM to store system parameters, When the AWR1843 is reset by the watchdog,  at this time, if the FEE erase operation is progress, the AWR1843 will stuck in ROM bootloader.

Is this a ROM bootloader bug, and if so, is there a workaround for this problem.

Thanks

  • Hi

    Cam you please provide more step by step details to understand the different modes your system is in?

    Thank you

    Cesar

  • Hi, Cesar

    The following steps can be cause the MCU stuck in ROM bootloader.

    1.Erase the last block(64KB) of the QSPI flash, This operation will take about 500ms

    2.Perform a warm reset 

    3.AWR1843 MCU restarted and ROM bootloader will try to load application code from QSPI Flash,but at this time,QSPI Flash write in progress

    4.The QSPI data captured by the logic analyzer at ROM bootloader startup  as follows:

     

    PS:QSPI Flash Status:0x43 means write in progress

  • By the way, the AWR1843 can start normally at next reset cycle,which mean the application code stored in QSpiFlash is correct.

  • HI,Cesar

    Is there any new development on this issue?

    Thank you

  • Hi,

    I have some more questions

    1) what is the HW platform being used. Is this a TI board or custom board.

    2) What type of flash memory are you using? What size?

    3) If you wait for the erase operation to complete, than there is no problem booting. Is this correct?

    4) The erase operation is started from your application software. Is this correct?

    thank you

    Cesar

  • Hi, Cesar

    1) what is the HW platform being used. Is this a TI board or custom board.

    Both TI board and custom board

    2) What type of flash memory are you using? What size?

    Flash type: MX25V1635F, 2.5V, 16Mb, 

    3) If you wait for the erase operation to complete, than there is no problem booting. Is this correct?

    yes

    4) The erase operation is started from your application software. Is this correct?

    yes 

    I have such an application scenario. When the application runs abnormally, the system may be reset by the watchdog. Assuming that the Flash is being erased at this time, in this case, I cannot wait for the Flash operation.

    Thank you

    YaFeng

  • HI,Cesar

    Is there any new development on this issue?

    Thank you

  • Hi YaFeng,

    When It gets stuck in ROM bootloader, Can you connect JTAG and read below:

    • Program Counter
    • QSPI status register : 0xC080004C

    Regards,

    Kaushal

  • hello,Kaushal

    If QSPIFlash is in WIP state before starting, the ROM Bootloader will read the content of QFlash when starting, but all the data returned at this time is 0x00, it will be stuck and cannot be started.

    Program Counter:

    Thanks 

    YAFENG

  • Yafeng,

    It seems like QSPI Flash was not detected by ROM bootloader, so this needs to be looked further. Can you confirm whether you are using TI EVM or your PCB. 

    Regards,

    Kaushal

  • Hello, Kaushal

    Both TI EVM and custom PCB have this problem,

    I think that when QFlash is in WIP (Write in progress) state, ROM Bootloader will not read valid data from Flash, so it thinks that Flash cannot be detected, but if Flash recovers from WIP state, read the data again , it should be able to read valid data.

    Yafeng

  • Yafeng,

    Thanks for the confirmation. We would need to recreate this at our end and debug further. Do you have test binary for us to check for you.

    Meanwhile we would look into our test code for recreating this. I believe this could take few days, so I request you to have some patience.

    Regards,

    Kaushal

  • Hello, Kaushal

    Sorry for the delay, Our binary file is confidential, but I can provide you with test codes later

    Regards

    Yafeng

  • Yafeng,

    Thanks. That would be helpful. Meanwhile we are trying with our test code.

    Regards,

    Kaushal

  • Hello,Kaushal

    The test code is in the attachment:

    /**************************************************************************
     *************************** Include Files ********************************
     **************************************************************************/
    
    /* Standard Include Files. */
    #include <stdint.h>
    #include <stdlib.h>
    #include <stddef.h>
    #include <string.h>
    #include <stdio.h>
    
    /* BIOS/XDC Include Files. */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/IHeap.h>
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/Memory.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Event.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/heaps/HeapBuf.h>
    #include <ti/sysbios/heaps/HeapMem.h>
    #include <ti/sysbios/knl/Event.h>
    #include <ti/sysbios/family/arm/v7a/Pmu.h>
    
    /* mmWave SK Include Files: */
    #include <ti/common/sys_common.h>
    #include <ti/drivers/pinmux/pinmux.h>
    #include <ti/drivers/osal/HwiP.h>
    #include <ti/drivers/esm/esm.h>
    
    /* SOC register file */
    #include <ti/drivers/soc/soc.h>
    #include <ti/drivers/qspiflash/qspiflash.h>
    #include <ti/drivers/qspi/qspi.h>
    #include <ti/drivers/pinmux/pinmux.h>
    #include <ti/drivers/soc/include/soc_internal.h>
    
    SOC_Handle      socHandle;
    
    void Test_resetTask(UArg arg0, UArg arg1)
    {
        /* Reset MCU after 10ms */
        Task_sleep(10);
        SOC_DriverMCB* socMcb = (SOC_DriverMCB*)socHandle;
        socMcb->ptrTopRCMRegs->SOFTSYSRST = 0xADu;
    }
    
    void Test_initTask(UArg arg0, UArg arg1)
    {
        int32_t             retVal = 0;
        Task_Params         taskParams;
        QSPI_Params         qSPIParams;
        QSPI_Handle         qSPIHandle;
        QSPIFlash_Handle    qSPIFlashHandle;
    
        QSPI_init();
        QSPIFlash_init();
        QSPI_Params_init(&qSPIParams);
    
        qSPIParams.qspiClk = 200 * 1000000U;
        qSPIParams.clkMode = QSPI_CLOCK_MODE_0;
        qSPIParams.bitRate = 40 * 1000000U;
        qSPIHandle = QSPI_open(&qSPIParams, &retVal);
        qSPIFlashHandle = QSPIFlash_open(qSPIHandle, &retVal);
    
        /* Create a backgroud task to reset MCU after 10ms */
        Task_Params_init(&taskParams);
        taskParams.stackSize = 4*1024;
        Task_create(Test_resetTask, &taskParams, NULL);
    
        /* Make QSPIFlash into WIP state, QSPIFlash will take about 500ms to erase a 64kB block */
        char wrBuff[512] = "abcdefghijklmnopqrstuvwxyz1234567890";
        QSPIFlash_blockErase(qSPIFlashHandle, 0x1E0000U);
        QSPIFlash_singleWrite(qSPIFlashHandle, 0x1E0000U, sizeof(wrBuff), wrBuff);
    
        /* After reset, MCU will be stuck in ROM bootloader */
    }
    
    
    /**
     *  @b Description
     *  @n
     *      Entry point into the test code.
     *
     *  @retval
     *      Not Applicable.
     */
    int main (void)
    {
        Task_Params     taskParams;
        int32_t         errCode;
        SOC_Cfg         socCfg;
    
        /* Initialize the ESM: Dont clear errors as TI RTOS does it */
        ESM_init(0U);
    
        /* Initialize the SOC confiugration: */
        memset ((void *)&socCfg, 0, sizeof(SOC_Cfg));
    
        /* Populate the SOC configuration: */
        socCfg.clockCfg = SOC_SysClock_INIT;
    
        /* Initialize the SOC Module: This is done as soon as the application is started
         * to ensure that the MPU is correctly configured. */
        socHandle = SOC_init (&socCfg, &errCode);
        if (socHandle == NULL)
        {
            System_printf ("Error: SOC Module Initialization failed [Error code %d]\n", errCode);
            return -1;
        }
    
        /* Debug Message: */
        System_printf ("**********************************\n");
        System_printf ("Debug: Mss Test Application Start \n");
        System_printf ("**********************************\n");
    
        /* Setup the PINMUX to bring out the QSPI */
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINR12_PADAP, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINR12_PADAP, SOC_XWR18XX_PINR12_PADAP_QSPI_CLK);
        
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINP11_PADAQ, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINP11_PADAQ, SOC_XWR18XX_PINP11_PADAQ_QSPI_CSN);
        
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINR13_PADAL, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINR13_PADAL, SOC_XWR18XX_PINR13_PADAL_QSPI_D0);
        
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINN12_PADAM, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINN12_PADAM, SOC_XWR18XX_PINN12_PADAM_QSPI_D1);
        
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINR14_PADAN, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINR14_PADAN, SOC_XWR18XX_PINR14_PADAN_QSPI_D2);
        
        Pinmux_Set_OverrideCtrl(SOC_XWR18XX_PINP12_PADAO, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR18XX_PINP12_PADAO, SOC_XWR18XX_PINP12_PADAO_QSPI_D3);
    
        /* Initialize the Task Parameters. */
        Task_Params_init(&taskParams);
        taskParams.stackSize = 6*1024;
        Task_create(Test_initTask, &taskParams, NULL);
    
        /* Start BIOS */
        BIOS_start();
    Exit:
        return 0;
    }
    
    

    Regards

    Yafeng

  • Thanks Yafeng,

    We will check this and get back

    Regards,

    Kaushal

  • Hi Yafeng,

    Thanks for your patience. We were able to recreate this issue on our end.

    When the radar resets due to the watchdog timer expiring, the warm reset sent to the board does not reset the SFLASH.

    So, if the SFLASH is busy with an operation and the radar device resets, the SFLASH continues with the operation without knowing that the radar has reset. When the bootloader tries to read the firmware from SFLASH after radar reset, it doesn’t get an appropriate response and hence cannot detect the SFLASH. The bootloader then proceeds to wait indefinitely to receive the firmware over SPI.

    We recommend that if you have long flash operations in your code, use the watchdog timer in NMI mode and reset the flash in the watchdog timer callback before resetting the device. Resetting the SFLASH stops any ongoing operations and puts it in standby mode. Please have a look at the attached code as a reference for implementing QSPIFlash_reset. The attached file extends the qspiflash driver, and can be included in your application code.

    Attachment: 

    #include <stdint.h>
    #include <stdlib.h>
    #include <stddef.h>
    #include <string.h>
    #include <stdio.h>
    
    #include <ti/common/sys_common.h>
    #include <ti/drivers/osal/MemoryP.h>
    #include <ti/drivers/osal/HwiP.h>
    #include <ti/drivers/osal/DebugP.h>
    #include <ti/drivers/osal/SemaphoreP.h>
    
    #include <ti/drivers/qspi/qspi.h>
    #include <ti/drivers/qspiflash/qspiflash.h>
    #include <ti/drivers/qspiflash/include/qspiflash_internal.h>
    
    
    void QSPIFlash_reset(QSPIFlash_Handle QSPIFlashHandle)
    {
    
        uint32_t            status;
        QSPI_Handle         QSPIHandle;
        SPIFLASH_Params     *ptrFlashParams;
        QSPIFLASH_Driver    *ptrQSPIFlashDrv;
    
        DebugP_assert(QSPIFlashHandle != (QSPIFlash_Handle)NULL);
    
        ptrQSPIFlashDrv = (QSPIFLASH_Driver *)QSPIFlashHandle;
    
        /* Get QSPI driver handle */
        QSPIHandle      = ptrQSPIFlashDrv->ptrQSPIHandle;
    
        /* Get flash parameter pointer */
        ptrFlashParams  = &ptrQSPIFlashDrv->flashParams;
    
        /*send reset enable command*/
        QSPIFlashWriteCmd(QSPIHandle, ptrFlashParams->resetEnableCmd, 1U);
        
        /*send reset command*/
        QSPIFlashWriteCmd(QSPIHandle, ptrFlashParams->resetCmd, 1U);
    
        /*Ensure reset command has come to effect*/
        do
        {
            status = QSPIFlashGetStatus(QSPIHandle, ptrFlashParams->readSR1Cmd);
        }while((status & FLASH_STATUS_BUSY) != 0x0U);
    
    }
    

    Regards,

    Aayush

     

  • Hi, Aayush

    Thank you very much for the solution,I will try to use your code to solve this problem.

    Regards,

    Yafeng

  • Thank you

    I will close this thread now.

    Cesar