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.

TMDS64EVM: Delay in user application startup due to OSPI(IS25LX256)

Part Number: TMDS64EVM
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hello TI support team.

The following are related questions.
e2e.ti.com/.../5130429

When I put flash settings in a user application, the startup of the user application is delayed in OSPI flash startup.


For the following sample programs of TMDS64EVM, the flash settings have been changed to IS25LX256 for custom boards.
ospi_flash_io_am64x-evm_r5fss0-0_nortos_ti-arm-clang

The flash settings on the SBL OSPI side were also changed to IS25LX256.

When a user application is booted from the XDS110 into RAM it starts immediately.

However, if I write a user application to the OSPI flash, it takes 5 minutes to start the user application as shown below.

[2024-06-10 18:55:12.547] 
[2024-06-10 18:55:13.953] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
[2024-06-10 18:55:13.953] DMSC Firmware revision 0x9
[2024-06-10 18:55:13.953] DMSC ABI revision 3.1
[2024-06-10 18:55:13.953] 
[2024-06-10 18:55:14.014] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH 
[2024-06-10 18:55:14.014] [BOOTLOADER_PROFILE] Boot Media Clock : 133.333 MHz 
[2024-06-10 18:55:14.014] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB 
[2024-06-10 18:55:14.014] [BOOTLOADER_PROFILE] Cores present    : 
[2024-06-10 18:55:14.014] r5f0-0
[2024-06-10 18:55:14.014] [BOOTLOADER PROFILE] SYSFW init                       :      12178us 
[2024-06-10 18:55:14.014] [BOOTLOADER PROFILE] System_init                      :     349086us 
[2024-06-10 18:55:14.014] [BOOTLOADER PROFILE] Drivers_open                     :         87us 
[2024-06-10 18:55:14.014] [BOOTLOADER PROFILE] Board_driversOpen                :        238us 
[2024-06-10 18:55:14.014] [BOOTLOADER PROFILE] Sciclient Get Version            :      10030us 
[2024-06-10 18:55:14.029] [BOOTLOADER PROFILE] CPU Load                         :       3781us 
[2024-06-10 18:55:14.029] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     375403us 
[2024-06-10 18:55:14.029] 
[2024-06-10 18:55:14.029] Image loading done, switching to application ...
[2024-06-10 19:01:25.877] All tests have passed!! ---> 5 min later after image loading done!

How can I make it start up faster even if I write to OSPI?
I attach the user application.

Best regards,
Kiyomasa Imaizumi.

rdg_ospi_flash_io_am64x-evm_r5fss0-0_nortos_ti-arm-clang.zip

  • Hello Kiyomasa,

    I do not see the issue on TI AM64x EVM as shown in the following boot logs. So, the issue might be because of the custom flash part you are using.

    [12:26:35.300] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
    [12:26:35.311] DMSC Firmware revision 0x9
    [12:26:35.313] DMSC ABI revision 3.1
    
    [12:26:35.315] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH
    [12:26:35.319] [BOOTLOADER_PROFILE] Boot Media Clock : 166.667 MHz
    [12:26:35.324] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB
    [12:26:35.328] [BOOTLOADER_PROFILE] Cores present    :
    [12:26:35.332] r5f0-0
    [12:26:35.333] [BOOTLOADER PROFILE] SYSFW init                       :      12170us
    [12:26:35.340] [BOOTLOADER PROFILE] System_init                      :     349499us
    [12:26:35.347] [BOOTLOADER PROFILE] Drivers_open                     :        321us
    [12:26:35.354] [BOOTLOADER PROFILE] Board_driversOpen                :      23052us
    [12:26:35.359] [BOOTLOADER PROFILE] Sciclient Get Version            :      10034us
    [12:26:35.366] [BOOTLOADER PROFILE] CPU Load                         :       4210us
    [12:26:35.373] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     399292us
    
    [12:26:35.379] Image loading done, switching to application ...
    [12:26:35.387] Starting ospi_flash_io example tests...
    [12:26:37.244] All tests have passed!!

    To start with, could you please apply the following patch in the ospi_flash_io.c that prints a debugging statement and share the logs? This will give a better picture of if this much time is taken by the initializing code or the R/W test code.

    diff --git a/examples/drivers/ospi/ospi_flash_io/ospi_flash_io.c b/examples/drivers/ospi/ospi_flash_io/ospi_flash_io.c
    index 4ec97339..c95d1c13 100644
    --- a/examples/drivers/ospi/ospi_flash_io/ospi_flash_io.c
    +++ b/examples/drivers/ospi/ospi_flash_io/ospi_flash_io.c
    @@ -57,6 +57,8 @@ void ospi_flash_io_main(void *args)
         status = Board_driversOpen();
         DebugP_assert(status==SystemP_SUCCESS);
     
    +    DebugP_log("Starting ospi_flash_io example tests...\r\n");
    +
         flashAttrs = Flash_getAttrs(CONFIG_FLASH0);
     
         /* Fill buffers with known data,
    

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    Thank you for your reply.

    >I do not see the issue on TI AM64x EVM as shown in the following boot logs. So, the issue might be because of the custom flash part you are using.

    I think so.
    And this problem does not occur when loading with ICE.

    I tried the debug output. Please check.

    [2024-06-12 08:08:17.255] 
    [2024-06-12 08:08:17.256] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
    [2024-06-12 08:08:17.256] DMSC Firmware revision 0x9
    [2024-06-12 08:08:17.256] DMSC ABI revision 3.1
    [2024-06-12 08:08:17.256] 
    [2024-06-12 08:08:17.309] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH 
    [2024-06-12 08:08:17.309] [BOOTLOADER_PROFILE] Boot Media Clock : 133.333 MHz 
    [2024-06-12 08:08:17.309] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB 
    [2024-06-12 08:08:17.309] [BOOTLOADER_PROFILE] Cores present    : 
    [2024-06-12 08:08:17.309] r5f0-0
    [2024-06-12 08:08:17.309] [BOOTLOADER PROFILE] SYSFW init                       :      12178us 
    [2024-06-12 08:08:17.309] [BOOTLOADER PROFILE] System_init                      :     349086us 
    [2024-06-12 08:08:17.309] [BOOTLOADER PROFILE] Drivers_open                     :         87us 
    [2024-06-12 08:08:17.309] [BOOTLOADER PROFILE] Board_driversOpen                :        239us 
    [2024-06-12 08:08:17.309] [BOOTLOADER PROFILE] Sciclient Get Version            :      10032us 
    [2024-06-12 08:08:17.329] [BOOTLOADER PROFILE] CPU Load                         :       3781us 
    [2024-06-12 08:08:17.329] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     375405us 
    [2024-06-12 08:08:17.329] 
    [2024-06-12 08:08:17.329] Image loading done, switching to application ...
    [2024-06-12 08:14:29.347] Starting ospi_flash_io example tests...
    [2024-06-12 08:14:29.955] All tests have passed!!
    

    Best regards,

    Kiyomasa Imaizumi.

  • Hello Prashant Shivhare.

    I have tried symbol loading for user applications at startup.
    It appears that the following while loop is waiting in the Flash_norOspiWaitReady function in the flash_nor_ospi.c file

        while((status != SystemP_SUCCESS) || (timeOut > 0))
        {
            status = Flash_norOspiCmdRead(config, cmd, cmdAddr, numAddrBytes, dummyBits, readStatus, numBytesToRead);
            if((status == SystemP_SUCCESS) && ((readStatus[0] & bitMask) == 0))
            {
                break;
            }
            timeOut--;
        }

    What does this mean? Please suggest how to solve it.

    Best regards,
    Kiyomasa Imaizumi.

  • Hello Kiyomasa,

    It appears that the following while loop is waiting in the Flash_norOspiWaitReady function in the flash_nor_ospi.c file

    Do you mean the ospi_flash_io is running successfully but most of the time is taken by this while loop in Flash_norOspiWaitReady function?

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    Do you mean the ospi_flash_io is running successfully but most of the time is taken by this while loop in Flash_norOspiWaitReady function?

    That's right.

    The ospi_flash_io is running.

    In the Flash_norOspiWaitReady function, timeOut is 0 and the status is SystemP_FAILURE.

    Function call order.
    
    Flash_open
    	Flash_norOspiOpen
    		OSPI_getHandle
    		OSPI_configResetPin
    		OSPI_setCmdExtType
    		Flash_norOspiSetProtocol
    			Flash_setOeBit
    			Flash_set888mode
    				Flash_norOspiRegRead
    					Flash_norOspiCmdRead
    				Flash_norOspiRegWrite
    					Flash_norOspiWaitReady --> Waiting for a long time.

    Best regards,

    Kiyomasa Imaizumi.

  • Hello Kiyomasa,

    In the Flash_norOspiWaitReady function, timeOut is 0 and the status is SystemP_FAILURE.

    In this case, the example should not run successfully at all.

    I guess the SBL OSPI already initializes the OSPI in 8d-8d-8d mode so it fails when the application tries to do it. However, the R/W test still passes successfully because the OSPI was in initialized state by SBL OSPI.

    Can you please try the following patch for SBL OSPI to close the driver and power off the OSPI.

    diff --git a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    index 7a52d3c4..ce33fa34 100644
    --- a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    +++ b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    @@ -273,6 +273,16 @@ int main(void)
                     {
                         status = Bootloader_rprcImageLoad(bootHandle, &bootImageInfo.cpuInfo[CSL_CORE_ID_R5FSS0_0]);
                     }
    +
    +                Drivers_ospiClose();
    +                DebugP_log("[SBL] OSPI driver closed\r\n");
    +
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_OSPI_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_FSAS_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0, 0);
    +
    +                DebugP_log("[SBL] OSPI devices powered off\r\n\r\n");
    +
                     status = Bootloader_runSelfCpu(bootHandle, &bootImageInfo);
                 }
                 /* it should not return here, if it does, then there was some error */
    

    Attached are the successful logs for TI EVM

    [11:26:39.156] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
    [11:26:39.166] DMSC Firmware revision 0x9
    [11:26:39.169] DMSC ABI revision 3.1
    
    [11:26:39.172] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH
    [11:26:39.176] [BOOTLOADER_PROFILE] Boot Media Clock : 166.667 MHz
    [11:26:39.179] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB
    [11:26:39.183] [BOOTLOADER_PROFILE] Cores present    :
    [11:26:39.187] r5f0-0
    [11:26:39.188] [BOOTLOADER PROFILE] SYSFW init                       :      12170us
    [11:26:39.196] [BOOTLOADER PROFILE] System_init                      :     349500us
    [11:26:39.202] [BOOTLOADER PROFILE] Drivers_open                     :        319us
    [11:26:39.208] [BOOTLOADER PROFILE] Board_driversOpen                :      23193us
    [11:26:39.214] [BOOTLOADER PROFILE] Sciclient Get Version            :      10039us
    [11:26:39.221] [BOOTLOADER PROFILE] CPU Load                         :       4207us
    [11:26:39.228] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     399435us
    
    [11:26:39.234] Image loading done, switching to application ...
    [11:26:39.239] [SBL] OSPI driver closed
    [11:26:39.242] [SBL] OSPI devices powered off
    
    [11:26:39.248] Starting ospi_flash_io example tests...
    [11:26:41.194] All tests have passed!!

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    Thank you for your reply.

    I have modified the SBL code and tried it.
    The output is as follows:

    [2024-06-13 15:51:24.289] 
    [2024-06-13 15:51:24.289] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
    [2024-06-13 15:51:24.289] DMSC Firmware revision 0x9
    [2024-06-13 15:51:24.289] DMSC ABI revision 3.1
    [2024-06-13 15:51:24.289] 
    [2024-06-13 15:51:24.351] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH 
    [2024-06-13 15:51:24.351] [BOOTLOADER_PROFILE] Boot Media Clock : 133.333 MHz 
    [2024-06-13 15:51:24.351] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB 
    [2024-06-13 15:51:24.351] [BOOTLOADER_PROFILE] Cores present    : 
    [2024-06-13 15:51:24.351] r5f0-0
    [2024-06-13 15:51:24.351] [BOOTLOADER PROFILE] SYSFW init                       :      12178us 
    [2024-06-13 15:51:24.351] [BOOTLOADER PROFILE] System_init                      :     349087us 
    [2024-06-13 15:51:24.351] [BOOTLOADER PROFILE] Drivers_open                     :         86us 
    [2024-06-13 15:51:24.351] [BOOTLOADER PROFILE] Board_driversOpen                :        239us 
    [2024-06-13 15:51:24.351] [BOOTLOADER PROFILE] Sciclient Get Version            :      10030us 
    [2024-06-13 15:51:24.364] [BOOTLOADER PROFILE] CPU Load                         :       3781us 
    [2024-06-13 15:51:24.364] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     375404us 
    [2024-06-13 15:51:24.364] 
    [2024-06-13 15:51:24.364] Image loading done, switching to application ...
    [2024-06-13 15:51:24.468] [SBL] OSPI driver closed
    [2024-06-13 15:51:24.468] [SBL] OSPI devices powered off
    [2024-06-13 15:51:24.468] 
    [2024-06-13 15:51:24.486] Start_01
    [2024-06-13 15:57:35.621] Starting ospi_flash_io example tests...
    [2024-06-13 15:57:36.240] All tests have passed!!

    But the situation did not change.
    It continues waiting in the while loop below.

    Best regards,

    Kiyomasa Imaizumi

  • Hello Kiyomasa,

    I see I forgot to close the Flash driver in the previous patch. Could you please try the following one

    diff --git a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    index 7a52d3c4..3ecbd122 100644
    --- a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    +++ b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    @@ -273,6 +273,19 @@ int main(void)
                     {
                         status = Bootloader_rprcImageLoad(bootHandle, &bootImageInfo.cpuInfo[CSL_CORE_ID_R5FSS0_0]);
                     }
    +
    +                Board_flashClose();
    +                DebugP_log("[SBL] Flash driver closed\r\n");
    +
    +                Drivers_ospiClose();
    +                DebugP_log("[SBL] OSPI driver closed\r\n");
    +
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_OSPI_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_FSAS_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0, 0);
    +
    +                DebugP_log("[SBL] OSPI devices powered off\r\n\r\n");
    +
                     status = Bootloader_runSelfCpu(bootHandle, &bootImageInfo);
                 }
                 /* it should not return here, if it does, then there was some error */
    

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    Thank you for your reply.

    I added Board_flashClose function and rebuild SBL OSPI.
    But the situation did not change.

    Best regards,
    Kiyomasa Imaizumi.

  • Hello Prashant Shivhare.

    The debug output is as follows:

    [2024-06-13 16:29:40.760] 
    [2024-06-13 16:29:40.760] DMSC Firmware Version 9.1.6--v09.01.06 (Kool Koala)
    [2024-06-13 16:29:40.760] DMSC Firmware revision 0x9
    [2024-06-13 16:29:40.760] DMSC ABI revision 3.1
    [2024-06-13 16:29:40.760] 
    [2024-06-13 16:29:40.814] [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH 
    [2024-06-13 16:29:40.814] [BOOTLOADER_PROFILE] Boot Media Clock : 133.333 MHz 
    [2024-06-13 16:29:40.814] [BOOTLOADER_PROFILE] Boot Image Size  : 0 KB 
    [2024-06-13 16:29:40.814] [BOOTLOADER_PROFILE] Cores present    : 
    [2024-06-13 16:29:40.814] r5f0-0
    [2024-06-13 16:29:40.814] [BOOTLOADER PROFILE] SYSFW init                       :      12178us 
    [2024-06-13 16:29:40.814] [BOOTLOADER PROFILE] System_init                      :     349087us 
    [2024-06-13 16:29:40.814] [BOOTLOADER PROFILE] Drivers_open                     :         87us 
    [2024-06-13 16:29:40.814] [BOOTLOADER PROFILE] Board_driversOpen                :        238us 
    [2024-06-13 16:29:40.814] [BOOTLOADER PROFILE] Sciclient Get Version            :      10038us 
    [2024-06-13 16:29:40.837] [BOOTLOADER PROFILE] CPU Load                         :       3780us 
    [2024-06-13 16:29:40.837] [BOOTLOADER_PROFILE] SBL Total Time Taken             :     375411us 
    [2024-06-13 16:29:40.837] 
    [2024-06-13 16:29:40.837] Image loading done, switching to application ...
    [2024-06-13 16:29:40.945] [SBL] Flash driver closed
    [2024-06-13 16:29:40.945] [SBL] OSPI driver closed
    [2024-06-13 16:29:40.945] [SBL] OSPI devices powered off
    [2024-06-13 16:29:40.945] 
    [2024-06-13 16:29:40.945] Start_01
    [2024-06-13 16:35:52.857] Starting ospi_flash_io example tests...
    [2024-06-13 16:35:53.468] All tests have passed!!

    Best regards,

    Kiyomasa Imaizumi

  • Hello Kiyomasa,

    Have you correctly integrated the flash configurations in the ospi_flash_io application?

    Maybe you can share the Sysconfig generated files for both sbl_ospi and ospi_flash_io application for comparison purposes.

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    The flash configuration is correctly entered in sysconfig as instructed previously.
    I am attaching the SBL and user application.

    Please check.

    Best regards,
    Kiyomasa Imaizumi.

    flash_proj.zip

  • Hello Prashant Shivhare.

    I'm not sure if this device can be used, so I'd like to resolve this issue as soon as possible.
    Thank you for your cooperation.

    Best regards,
    Kiyomasa Imaizumi.

  • Hello Kiyomasa,

    Since the issue is coming only with the custom flash part you have on your board, we will be limited in finding the root cause. The best we can do is trial and error and see if something works out.

    In that line, can you try doing the Flash Reset in SBL OSPI before jumping to application with the following patch

    diff --git a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    index 7a52d3c4..a97d5d93 100644
    --- a/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    +++ b/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/main.c
    @@ -273,6 +273,10 @@ int main(void)
                     {
                         status = Bootloader_rprcImageLoad(bootHandle, &bootImageInfo.cpuInfo[CSL_CORE_ID_R5FSS0_0]);
                     }
    +
    +                Flash_reset(gFlashHandle[CONFIG_FLASH0]);
    +                DebugP_log("Flash reset done\r\n\r\n");
    +
                     status = Bootloader_runSelfCpu(bootHandle, &bootImageInfo);
                 }
                 /* it should not return here, if it does, then there was some error */
    

    If this doesn't work, do you have a way to do Flash reset via hardware itself?

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    Thank you for your reply.

    I tried your fix, and now the user application seems to start without any problems.
    Thank you.

    @@ -288,6 +288,22 @@
                     {
                         status = Bootloader_rprcImageLoad(bootHandle, &bootImageInfo.cpuInfo[CSL_CORE_ID_R5FSS0_0]);
                     }
    +#if 0
    +                Board_flashClose();
    +                DebugP_log("[SBL] Flash driver closed\r\n");
    +
    +                Drivers_ospiClose();
    +                DebugP_log("[SBL] OSPI driver closed\r\n");
    +
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_OSPI_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0_FSAS_0, 0);
    +                SOC_moduleClockEnable(TISCI_DEV_FSS0, 0);
    +
    +                DebugP_log("[SBL] OSPI devices powered off\r\n\r\n");
    +#else
    +                Flash_reset(gFlashHandle[CONFIG_FLASH0]);
    +                DebugP_log("Flash reset done\r\n\r\n");
    +#endif
                     status = Bootloader_runSelfCpu(bootHandle, &bootImageInfo);
                 }
                 /* it should not return here, if it does, then there was some error */
    
    

    I'll keep an eye on this for a while.
    What could have gone wrong?

    Best regards,
    Kiyomasa Imaizumi.

  • Hello Kiyomasa,

    That's good to know that the Flash Reset worked.

    I think this should be the solution because before reinitializating any peripheral (ospi here from ospi_flash_io), it should ideally be in a reset state to avoid incompatibility with the previous initialization of the peripheral.

    Regards,

    Prashant

  • Hello Prashant Shivhare.

    I have one question.
    This user application project is for CR5, but if I want to run it on CA53, will it work if I configure the flash in the same way?
    However, when I looked at the syscfg of CA53, there was no OSPI setting.

    Best regards,
    Kiyomasa Imaizumi.

  • Hello Prashant Shivhare.

    I've attached a picture of the CCS settings.


    Best regards,
    Kiyomasa Imaizumi.

  • Hello Kiyomasa,

    The OSPI driver does not have the support for A53/M4F core. It's available only for R5F core.

    This is mentioned in the buildsheet: software-dl.ti.com/mcu-plus-sdk/esd/AM64X/09_02_01_05/exports/docs/build_sheet/am64x-sw-buildsheet.html

    Regards,

    Prashant