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.

TMS320F28374S: Get Reset Cause

Part Number: TMS320F28374S
Other Parts Discussed in Thread: C2000WARE

Hello,

is it possible to have an example about the correct way to get the reset cause of the microcontroller.

I have performed some tests, I have found the following results:

Reset cause RESC register driverlib APIs
POR

No bit set.

Expected (POR and XRSn bits set).

No bit set.

Expected (POR and XRSn bits set)

WDT WDRSn bit set (OK) XRSn and WDRSn bits set
Debugger No bit set (OK)

No bit set or XRSn bit set.

The last case XRSn bit seems to be sticky after performing a WDT reset.

Thank you,

Carlo

  • Carlo,

    POR bit get cleared in BOOTROM code to avoid confusion between POR and XRSn (both get set incase of PORn).

    WD reset toggles XRSn as well hence you see both get set. XRSn should be looked at only of WD is not set.

    Debugger is debug reset and does not toggle XRSn (it's internal reset) hence none of the status flag gets set.

    Hope this helps.

    Regards,

    Vivek Singh
  • Hello Vivek,
    and thank you for explanation.

    However haven't understood yet the different behaviour between reading directly the RESC register and using driverlib API SysCtl_getResetCause(), as I have reported above.
  • Carlo, sorry for late reply. The only difference seems to be with WD reset but that should set the XRSn bit as well since XRSn does toggle on WD reset. I am not sure why are you not seeing XRSn bit set when looking at RESC bit directly. Can you confirm how are you observing it directly and when ?

    Regards,
    Vivek Singh
  • void main(void)
    {
        // disable and config wtachdog
        SysCtl_disableWatchdog();
        SysCtl_setWatchdogPrescaler(SYSCTL_WD_PRESCALE_1);
    
        // copy time critical code and flash setup code to RAM
        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t) &RamfuncsLoadSize);
    
        // initialize flash controller
        Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, FLASH_WAITSTATES);
    
        // initialize clock 
        InitClock();
    
        // get reset cause
        info_p->resetCause = CpuSysRegs.RESC.all & RESET_CAUSE_MASK;
        CpuSysRegs.RESC.all = info_p->resetCause;
    
        // initialize GPIO
        InitGPIO();
    
        // initialize the interrupt controller
        Interrupt_initModule();
        Interrupt_initVectorTable();
    	
    	...
    }
    Hello Vivek,

    I guess that I dont't find the XRSn bit set, when reading the RESC register, because it has been cleared by the boot ROM (rif. spruhx5e).

    The driverlib API SysCtl_getResetCause(), indeed, reads both the RESC register and the boot ROM Status, and put in OR the result.

    The same is true for POR bit.

    The problems using SysCtl_getResetCause() are:

    - I do never find the POR indication;

    - Once the the XRS indication has been set it remains set also across new reset events, that don't affect the XRS signal.

    I am using C2000Ware 1.00.04.00.

    Please refere the code snipped attached.

    Thank you,

    Carlo

  • Ok, I'll report XRSn issue to our SW team. POR bit also get clear in BOOTROM hence you don't see this set. If nothing is set then it's POR.
    Let me know if there is any other info you are looking for.

    Regards,
    Vivek Singh