AnsweredAssumed Answered

Problem with Watchdog in a S08PA4

Question asked by Omar Ayala on May 12, 2016
Latest reply on May 18, 2016 by vicentegomez

Hi every one,

I am experiencing problems with the Watchdog of a S08PA4. I configure it like this just right after power on (so the 128 clocks condition is met):

 

------------------------------------------------------------------------------

  Os_F_DisAllInterrupts_v(); 

  Sys_f_InitCLKModule_v();  /* Initialize clock module ( Bus clock set to 19,2 MHz)  */

  WDOG_TOVAL = (uint16_t)32000;

  //WDOG_WIN = ZERO_U8; /* This is not necesary since I am not using window watchdog */

  WDOG_CS2 = 0x42;

  /*( Sys_d_WDOG_CS2_WIN_OFF| Sys_d_WDOG_CS2_IRQ_FLAG| Sys_d_WDOG_CS2_256_PRESCALAR_OFF| Sys_d_WDOG_CS2_CLK_IS_BUS_CLK); */      

WDOG_CS1 = 0x84;

  /*( Sys_d_WDOG_CS1_WD_ENA| Sys_d_WDOG_CS1_WD_IRQ_DIS| Sys_d_WDOG_CS1_UPDATE_OFF| Sys_d_WDOG_CS1_TST_DIS|      

      Sys_d_WDOG_CS1_IN_DBG_ON| Sys_d_WDOG_CS1_IN_WAIT_OFF| Sys_d_WDOG_CS1_IN_STOP_OFF );*/

  Os_F_EnAllInterrupts_v();

------------------------------------------------------------------------------

 

After this I initialize all the application modules and go to the Cyclic mode. There I refresh the watchdog using the following function:

 

------------------------------------------------------------------------------

void Os_f_FeedIntWD(void)

{

  Os_F_DisAllInterrupts_v();

  WDOG_CNT=(uint16_t)0xA602;

  WDOG_CNT=(uint16_t)0xB480;

  Os_F_EnAllInterrupts_v();      /* the sequence 0xA602, 0xB480 will reset the watchdog */

}

------------------------------------------------------------------------------

 

After reading in other threads I understood that while debugging, one should not set a brakepoint (BP) or step inside this function. So I placed a BP right after returning from this function (no other BP was active). The System starts but does not reach the BP and the Debugger shows reset and I loose connection to the µC. When I place a BP during the initialization of the application I can see that the time is correct. I mean, the refresh point is not too late. I can even set a BP just before the refresh function is called the first time and it is reached.

 

Am I missing something?

Can anybody find a mistake in the way I am initializing the watchdog?   

 

 

I have tried using other timing configuration like using bus clock or the 1KHz bus clock and offcourse modifying properly the WDOG_TOVAL. I have even made a stand alone version (no debugger connected) with the Debug-enable bit set to zero and the result was the same (the application does not run).

When I deactivate the watchdog and its refreshing function, the application runs without a Problem.

Please I have no idea what else I can do.

Omar

Outcomes