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.

Use of a watchdog - Reset CPU

Hi,

I want to use the watchdog in reset mode by changing some things in the example file from Ti but something is missing in what I have done because nothing happens... If somebody could help me...Thank you

#include "DSP2833x_Device.h"     // Headerfile Include File
#include "DSP2833x_examples.h"   // Examples Include File
 
// Prototype statements for functions found within this file.
interrupt void wakeint_isr(void);
 
// Global variables for this example
Uint32 WakeCount;
Uint32 LoopCount;
 
void main(void)
{
 

   InitSysCtrl();

   DINT;
 
   InitPieCtrl();
 
   IER = 0x0000;
   IFR = 0x0000;

   InitPieVectTable();
 

   /*EALLOW;  // This is needed to write to EALLOW protected registers
   PieVectTable.WAKEINT = &wakeint_isr;
   EDIS;   // This is needed to disable write to EALLOW protected registers*/
     

 
 
   EALLOW;
   SysCtrlRegs.SCSR = 0x0000;
   EDIS;
 
/*// Enable WAKEINT in the PIE: Group 1 interrupt 8
// Enable INT1 which is connected to WAKEINT:
   PieCtrlRegs.PIECTRL.bit.ENPIE = 1;   // Enable the PIE block
   PieCtrlRegs.PIEIER1.bit.INTx8 = 1;   // Enable PIE Group 1 INT8
   IER |= M_INT1;                       // Enable CPU int1
   EINT;                                // Enable Global Interrupts*/
 
// Reset the watchdog counter
   ServiceDog();
       
// Enable the watchdog
   EALLOW;
   SysCtrlRegs.WDCR = 0x0028;  
   EDIS;
    
// Step 6. IDLE loop. Just sit and loop forever (optional):
   for(;;){
 
      LoopCount++;
         
      // Uncomment ServiceDog to just loop here
      // Comment ServiceDog to take the WAKEINT instead
      // ServiceDog();
   }
     
 

} 

  • Cedric,

    So how do you know "Nothing happens?"  Did you observe the RSTn signal on a scope to see if it is pulsing?

    Erase the flash, and then power-up the device.  You should see the RSTn signal periodically pulsing because if you do nothing for code in the device, the WD will just keep resetting the device.  This will tell you the WD is working.  Then you can put your code back in and try the same test.  Your code looks OK to me.  SCSR=0x0000 and WDCR=0x0028 seem correct.

    Regards,

    David

  • Hi,

    Thank you for your answer. In fact, I believe nothing happens because I have put a breakpoint at the beginning on my code and if the CPU was reseted I thought it would pass again and again at the beginning of my code, or am I wrong ? But you are right I will see the RSTn signal to know if something happens. Thank you

  • Cedric,

    Cedric D said:

    I believe nothing happens because I have put a breakpoint at the beginning on my code and if the CPU was reseted I thought it would pass again and again at the beginning of my code, or am I wrong ?

    I was about to say you are quite right about the breakpoint because that is the test we use in our workshop labs.  But then it occurred to me that you are probably running from flash?  If so, you are setting up a HW breakpoint, and when the WD resets the processor the HW BP settings are almost certainly cleared.  When we run this test in the workshop, we are setup to run from RAM and the BP used is a SW BP and this is unaffected by a reset.

    So definitely check the RSTn pin.  If RSTn pin is not easy to access, you could setup a GPIO pin to pulse at the start of your code and monitor that instead.

    Regards,

    David

     

  • Hi,

    Thank you for your answer but it doesn't work yet. I run from RAM and not from Flash for precision. I have done what you explain to me, I have verified with scope the period of the pulse of a GPIO pin which could change at the beginning at my soft but nothing happens, there is no pulse because nothing changes the infinite loop run and run whitout stopping. Is there any other flags I would have forgotten ? I precise the Watchdog in interrupt mode with the basic example file works fine for me so it is just the reset mode... I use a XDS100 to develop, is there any conflict with it to avoid resetting ? Thank you to help me. Have a good day.

    Regards,

    Cedric

  • The emulator has no ability to interfere with a WD reset.

    The question is not what you have to do to get the WD reset to work.  The WD is running by default after reset and will trigger a reset if you do nothing.  So the question is what you might be doing to disable this.

    As I suggested in my earlier post, erase the flash in the device and then power cycle.  Monitor the RSTn pin on a scope.  You should see if pulsing active periodically since the WD will continuously reset the device.  If you do not see this happening, then the device is damaged (although this is pretty unlikely).  I'd do this first to rule out this possibility.

    - David