Problem with Watchdog in a S08PA4

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Watchdog in a S08PA4

396 Views
omarayala
Contributor II

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?   

 

149166_149166.pngpastedImage_11.png

 

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

Labels (1)
Tags (2)
0 Kudos
1 Reply

284 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi Omar

Please try with

WDOG_CNT = 0xC520;         /* First part of the WDG unlock sequence */

WDOG_CNT =0xD928;         /* Second part of the WDG unlock sequence */

  /*  Initialization of Init_WDOG */

  /* WDOG_CS1: EN=1,INT=0,UPDATE=1,TST=0,DBG=0,WAIT=1,STOP=1 */

WDOG_CS1 = 0xA3;            

  /* WDOG_CS2: WIN=0,FLG=0,??=0,PRES=0,??=0,??=0,CLK=0 */

WDOG_CS2 =0x00;            

  /* WDOG_TOVAL: TOVAL=0xF800 */

WDOG_TOVAL =0xF800; 

Also you can use processor expert to set the WDG

I hope this will help you

regards

Vicente Gomez

0 Kudos