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.

TMS570LS3137: SYSESR Register is not working as intended while observing reset source in debug mode

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hi, When I read the datasheet, there said;

BIT15 notifies that power on reset occured, what I understood from this is when my uC powered up, this bit will be pulled high.

But, in debug mode I've never seen this bit at High. Only External RST Flag (EXTRST) goes high.

In my application, I have to observe whether my system comes from power-up or software reset.

On the other hand, are there any interrupt handler which notifies that uC is about to power-down ? 

  • I noticed that 

    void _c_int00(void)
    watches the state of these flags and clears if triggered. So, I putted a breakpoint  into this "if" guard on the line here 

        /* check for power-on reset condition */
        /*SAFETYMCUSW 139 S MR:13.7 <APPROVED> "Hardware status bit read check" */
        if ((SYS_EXCEPTION & POWERON_RESET) != 0U)
    in order to observe. But Application never hit that breakpoint whenever I build&run the code.

    On the other hand, WATCHDOG_RESET behaves like POWERON_RESET. It goes high at startup and is cleared in _c_int00 function and never triggered after that till power up event happens once again.

    Btw, Loading Code into the uC should be trigger POWERON_RESET right ?

  • Hi Ismail,

    The power-on-reset is only triggered by power cycling the device or pulling the nPORRST pin to LOW then HIGH. Loading code into the uC will not trigger Power-on-reset.

    You can top the code execution before the SYSESR is cleared, then read the real value of SYSESR register.

    After power-on-reset, the code will stop at while(adc==0). Connect the JTAG emulator to target, and read the SYSESR value from the register window:

  • Hi Mr. Wang, I defined a global variable and assigned SysEsr Content to this variable but, When the program jumped to Main Function the  after completed startup issues, my global variable content is reset due to the resetting ram-rom operations before exit startup.

    What is the best approach to save SysEsr content ? Someone has advised to use FLASHBANK7, in this case, I wonder that where is the best place to insert "the  code that program flashbank7" in startup function, this is important because if I insert the code where a necessary thing did not initialize may cause error.

    I tried to program flashbank7 in startup but I got failed. I uploaded the code where I inserted. I just tried a dummy bytes to write  Fbank7 start address.

    code is stucked where query the state of FMdlStat register in FlashWrapper if I am right.

    FMdlStat  value is 0x00000410(hex). This means 10. and 4. bit are set. 

    10.bit says

    Erase Verify
    When set, indicates that a sector is not successfully erased after the maximum allowed number of
    erase pulses are given for erase operation. During Erase verify command, this flag is set
    immediately if a bit is found to be 0.

    What I have to do ? 

    We use crystal osc at 16MHz and convert it 160Mhz via PLL.

    This code block work in main well.

    Finally, this code only works after __TI_auto_init function is executed.

  • The global variable content will be cleared by memoryInit(), Pbist, and  __TI_auto_init() in _c_int00().

    The HALCOGen can generate FEE driver for erasing/programing bank 7 which is used as emulated EEPROM.

    You need to enable FEE driver first:

    Please follow the instruction of the FEE example:

  • Sir Wang, I reviewed the example,

    TI_Fee_WriteSync(BlockNumber, &SpecialRamBlock[0]);
    SpecialRamBlock is passed as parameter without its size info. How does this function know size of array to be write ?
    I reviewed the code but did not find. Where I can find the BlockNumber id list and also  in which address block that they point ?
    I could not find in manual.
    This module is dedicated only to program or erase FLASH BANK7 right ?
  • Hi Ismail,

    From HALOCGen FEE configuration windows, you define the number of blocks, and size of each block. When you call the FEE APIs, using the block number as the function argument is enough.

  • The user guide is at:

    C:\ti\Hercules\HALCoGen\v04.07.01\Docs

  • Hmm now it's okey. One more question, In that example there is a piece of code 

    	do
    	{
    		TI_Fee_MainFunction();
    		delay();
    		Status=TI_Fee_GetStatus(0);
    	}
    	while(Status!=IDLE);

    Is this code necessary to call after each erase or program function called ?

  • The TI_Fee_MainFunction() is used to finish the flash or data operations initiated by erase/write functions. It should be called at regular intervals.

    I call this function after calling erase/program (async) function

  • Thank you Sir Wang, I will try these api functions in sys_startup to save SYSESR content and will give feedback about results.