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.

CCS/TMS570LS3137: how to jump to app after power cycle

Part Number: TMS570LS3137

Tool/software: Code Composer Studio

Hi ,

In the thread below,you advise a S/W system reset before booloader jump to app.

https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/225447/994487#994487

I have tryed in my project and it works.

After the software reset ,in the beginning of the c_int00, in the USER CODE BEGIN (5), i use "if(systemREG1->SYSESR&0x10)" to jump to app.

But this doesn't work after power cycle, how to do it then?

I have tryed to write a flag in the start of sector 3 ,bank7(0xF020_C000) , before the  S/W system reset.

In my proj. i used sector 0~2 as FEE, i write the flag just use the flash api,not fee drive.

I think if i read the flag befor i check SYSESR after power cycle, then i can jump to app. the code list:

void _c_int00(void)
{

/* USER CODE BEGIN (5) */
uint32 app_start_flag;
app_start_flag=(*(uint32 *)(0xF020C000));

However sometimes it works ,some times it caused a nerror and the red led lighted in the 570HDK.

and there some questions i need your help:

1、how to jump to app after power clcye?

2、how to jump to bootloader from app? a S/W system reset will cause a endless loop.

3、what caused the nerror?what's the diffrence between this kind of read a  flash address and the Fapi? Or the init of the flash have to be done first?

Best regards,

guodong

  • Hello Guodong,

    First, Zhaohong is no longer in the Hercules team so he is not available to respond.

    In regard to the SW reset, this was recommended because there seemed to be some setting in the bootloader that conflicted with the desired setting in the application relative to the customers code that was being discussed in the other thread. From my perspective, the SW reset is only a patch for a problem where the application is not initializing something properly for the application that was previously initialized in the boot loader. In my view, the SW reset should not be needed every time the Boot loader executes and should only be used when a new source/application is downloaded and programmed into flash.

    In any event, using the SW reset you would need to check the state of the SYSESR register and look for both the SW reset and the Power On Reset flags. In the event the power on reset flag is set, execute the boot loader path, if the SW reset flag is set, skip the boot loader and proceed to the application.

    When using the content of the SYSESR register to determine the cause of reset, it is important to insure the bits are cleared after they are read and captured to prevent issues reading the register and making decisions based on the content. i.e., if the device goes through PORST and this bit is not cleared before the instantiation of the SW reset, both the PORST and SWRST bits will be set after the SWRST ocurrs because a warm reset such as caused by a CPURST, WDRST/DEBUGRST, SWRST, etc. will not cause the SYSESR register to be cleared. Only a PORST reset will clear the SYSESR register. I suspect this is the cause of your erratic behavior.

    Finally, you have asked how to jump to the boot loader from the application? This is really dependent on your application. In most cases a bootloader is positioned at boot time (thus the name) and checks for the re-programming conditions at boot time during the boot loader. In this case, the boot loader would look for some condition such as a UART/CAN/SPI message at start up and if not received in a specified time period it would proceed to the application. The condition could also be tied to HW state where certain GPIO are forced to an unusual state which forces entry into the boot loader routine rather than the application mode.
  • Hello Chuck,

    Tank you so much to reply so quickly! This really help me a lot!

    I read the application report SPNA106D again, and here is a doubt i want to make sure:

    Before to read flash bank7  like " app_start_flag=(*(uint32 *)(0xF020C000)); ", the register about address wait state and data wait state need to be configured?

    I mean if i need to do this after setupFlash() ?

    Best regards,

    Guodong

  • Hello Guodong,

    If you are reading from the Bank7 while operating at less than or equal to 50MHz, it will be OK because no wait states or pipelining is required there. Note that this frequency will be different for som hercules devices and 50MHz applies to the LS3137. Once the PLL has been enabled, you would have to have configured the flash waitstates accordingly but this is also true for Bank0 and program execution.

    In short, I think it should be OK on this device.