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.

Watchdog re-enables itself

Other Parts Discussed in Thread: TMS320F28335, STRIKE

Hello,

I disable the watchdog at the start of my application (WDCR shows up as 0x0040, which means the watchdog is disabled).

For some reason, when stepping through my code after some time, the watchdog gets re-enabled (and the SYSCTRL registers get messed up) without any apparent reason. It is roughly at the same location that this occurs, but not exactly the same location each time...

Would anyone have any idea about why this is happening?

Many thanks for any help!

  • Hi,

    Sometime I have seen this happening due to stack overflow.  Please check if same thing is happening in your case too.

    Regards,

    Vivek Singh

  • Hi,

    few questions:-

    How are you disabling the watchDOG? are you using driverlib/headerfiles provided function call? which device is this question on? Can you copy paste the code that you are using to disable watchdog? Are you doing any debug reset after you disable watchdog? are you setting WDOVERRIDE bit after you disable watchDOG - just to be sure that this is not being reset in any interrupt?

    Also make sure that device is not getting reset when you are trying to write to this location, check for WDCHK bits and WDOVERRIDE bits.

     

    Best Regards

    Santosh

     

     

  • Dear Santosh,

    1. I disable the watchdog by setting the WDDIS bit to 1 (code excerpt below).
    2. I am not using the "driverlib/headerfiles" to disable the watchdog.
    3. What is a debug reset?
    4. I do not set the WDOVERRIDE bit, and I can see it stays at 1 even after the watchdog got re-enabled.

    I don't understand your last phrase.

    To the first reply: the stack size is large (0x1000), and using the memory viewer, I can see that only the first few dozen words are used.

    Best regards

  • I forgot to give the excerpt of my source code to disable the watchdog. Here it is:


    // Bits in the WDCR register
    const Uint16 kWdcrWdchk  = 0x0028;
    const Uint16 kWdcrWddis  = 0x0040;
    const Uint16 kWdcrWdflag = 0x0080;


    void WatchdogInit()
    {
        EALLOW;

        // WDCR register
        //  WDPS=0   - Watchdog prescaler: will be set later
        //  WDCHK    - Fixed value used for control
        //  WDDIS=1  - Disable the watchdog for now
        //  WDFLAG=1 - Reset the watchdog flag
        SysCtrlRegs.WDCR = kWdcrWdchk | kWdcrWddis | kWdcrWdflag;

        EDIS();
    }

  • Which device is this?

    can you quickly try the below code instead of yours and let us know if it works. Also are you running the code from flash and in stand-alone mode (without debugger)? Debug reset, is the target reset that you initiate via CCS.

    EALLOW;

    SysCtrlRegs.WDCR = 0x0068; // Disable watchdog module

    EDIS;

     

    Best Regards

    Santosh

     

  • Dear Santosh,

    It's a TMS320F28335.

    I tried WDCR=0x68 as suggested, which does not work. That was to be expected because that's what I was doing before.

    If there a way to put a breakpoint to when this register is changed? I am using CCS 4.2.4 with an XDS100 emulator.

    Many thanks for your help!

  • Hi,

    Are you able to identify which part of your code is causing watchDOG to re-enable. I think this is just a symptom not cause. WatchDOG is a pretty stable module and exists across all C28x devices. If you have any other F28335 device/board with you can you try on that. If you don't see issue on anyother device then this one is a bad device (I highly doubt this would be the case, but just to strike off another variable out of equation).

    I suspect something else is going wrong in your device and is getting reset and on reset WatchDOG is being reenabled automatically. Here is what you can do...

    After you connect the device, do a debug reset and in dis-assmebly window put a break point whereever the PC is at - at reset. If you do that you will be able to catch if device is getting reset. Now load your program and put a break point afer you write to WDCR to disable watchDOG and run. Check WDCR register in memory window and run, see if it hits reset.

    Now, do you enable PIE in your application? if so what does your iTRAP handlers  and unsupported interrupt handlers do? do they enable watchDOG? do enable watchDOG in any part of your applicaiton code?

    Regarding below, I haven't explored that option - break on memory location value change, I always miss that and always find another way to debug the issue.

    Investigator said:

    If there a way to put a breakpoint to when this register is changed? I am using CCS 4.2.4 with an XDS100 emulator.

     

    Best Regards

    Santosh

     

     

  • Dear Santosh,

    I tried your first suggestion. I swapped my board for a colleague's, and the problem disappeared! So it looks like a hardware problem on our side.

    That should have been for me the first thing to try... My apologies for wasting your time...

    Best regards,

      Fabrice