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.

Bad Watchdog1

Please can someone with experience with watchdog1(using PIOSC) assist me?

I am using watchdog0 and watchdog1 with a NMI in my application for added safety. I can easily get watchdog0 to run, but watchdog1 hangs the micro during the initialisation code. The odd thing is that when I run this code with the debugger connected, both watchdogs are initialised and run correctly, without the debugger the code gets stuck (and neither watchdog causes a reset). I have tested and know for sure that watchdog1 is being the bad dog here.

Below is my initialisation code for watchdog1. What have I missed here, do I need to do anything else special with PIOSC clock settings?

LM4F232H5QC @50MHz (system clock)

                  

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG1);

                  ROM_SysCtlDelay(5);

                 

    ROM_WatchdogEnable(WATCHDOG1_BASE);

 

                  while(!HWREGBITW(&WATCHDOG1_CTL_R, 31)); //wait for WRC to clear

 

                  ROM_WatchdogIntTypeSet(WATCHDOG1_BASE, WATCHDOG_INT_TYPE_NMI);

 

                  while(!HWREGBITW(&WATCHDOG1_CTL_R, 31));

             

                  ROM_WatchdogReloadSet(WATCHDOG1_BASE, ROM_SysCtlClockGet());

 

                  while(!HWREGBITW(&WATCHDOG1_CTL_R, 31));

                           

                  ROM_WatchdogResetEnable(WATCHDOG1_BASE);

 

                  while(!HWREGBITW(&WATCHDOG1_CTL_R, 31));

 

                  ROM_WatchdogStallEnable (WATCHDOG1_BASE);

             

                  while(!HWREGBITW(&WATCHDOG1_CTL_R, 31));

 

                  ROM_WatchdogLock(WATCHDOG1_BASE);

 

                  ROM_IntEnable(INT_WATCHDOG);

  • Hi Simon,

    I'm sorry for the delay in answering your question.  It slipped through the cracks somehow.

    I'm not totally sure what is going on, but my guess is it has something to do with the check for the write complete (as you don't use that for watchdog 0 and watchdog 0 works fine).

    Along those lines, I have some thoughts:

    • When you have the debugger connected, do you step through the code or do you run until you hang?
    • If you don't have the debugger connected, how do you know it is hanging in the initialization code?
    • You should configure the watchdog before enabling it - move the ROM_WatchdogEnable(WATCHDOG1_BASE); call to the end
    • Try changing the while loop to say while(!HWREG(WATCHDOG1_BASE = WDT_O_CTL) & WDT_CTL_WRC);  I want to see if it works without using the bit banding.  Please let me know what happens.
    Regards,
    Sue
  • @Stellaris Sue-

    What a great responding post! (believe you got it - but great even w/possible hiccup)  Happy Easter...

  • Hi Sue,

    Thanks for the response.

    To answer your questions:

    1. I have tried both single stepping and free run with the debugger connected, the code works fine with both options. I have the problem with the debugger disconnected only
    2. I know it gets stuck because directly after the watchdog initialisation, I initialise an LCD and LED driver. Neither LCD or LEDs or application responds from here on. Also if I comment out watchdog1 initialisation code everything runs smoothly
    3. I will need to try the other two options tomorrow morning. -  I will post the results as soon as I have them
    Simon
  • Hi Sue, I have tried the last two suggestions and I still haven't had any luck getting watchdog1 to properly work without the debugger. I'm stumped

    Regards,

    Simon 

  • Simon,

    I spoke to one of the software engineers, and he believes that when you are using StellarisWare APIs to run the watchdog, you don't need to check the WRC bit because there is enough delay built into the calls.  Try removing the lines that check this bit and see what happens.

    Regards,

    Sue

  • Hi Sue, I just tried that now, still no luck...

  • Hi Simon,

    I just took the watchdog example that comes with the EK-LM4F232 board and I modified it to use watchdog 1 instead of watchdog 0.  I also changed the clock to 50 MHz instead of 16 MHz.  The software works on my board without using the debugger.  Please try this experiment yourself on your EK and let me know what your results are.

    Thanks,

    Sue

  • Hi Simon,

    I have another test for you to try.  Using your original software, try enabling ADC0 or SSI0 using SysCtlPeripheralEnable function prior to configuring watchdog 1.  Please let me know what your results are.

    Regards,

    Sue

  • Hi Sue,

     

    Ok I just tried enableing ADC0 and now Watchdog1 is working! Is this a silicon errata? Please can you explain why this made it work and what the implications are.

    Thanks!

     

  • Hi Simon,

    Yes, I believe you have discovered a silicon erratum.  We are investigating and I expect this issue to be included in the next errata release.  Basically, in order to use watchdog 1, you have to enable the clock to another module that can use the PIOSC as a clock (UART, SSI, ADC).  I'm sorry for your difficulties.

    Regards,

    Sue

  • Hi Sue,

     

    Thanks for the help and feedback,much appreciated!

    Is there anyways you could give me a heads up or email me the new Errata sheet as soon as it is available?

  • Simon,

    There is a link on the product page (http://www.ti.com/product/lm4f230e5qr) that you can use to set up alerts anytime the information on the page is updated:

    Regards,

    Sue