Hi,everyone.
I have got a problem with WatchDog Configuration of the s9keazn8.
Mcu:s9keazn8 ;
Tool: PE micro multilink universal
software:S32 Design Studio for ARM;Version: 2018.R1
I use the following code ; I do not get 1s periodic reset but get 51s periodic
#define DisableInterrupts asm("CPSID i")
#define EnableInterrupts asm("CPSIE i")
void WatchDogCfg(void)
{
DisableInterrupts;
WDOG_CNT = 0X20c5;
WDOG_CNT = 0X28d9;
WDOG_TOVAL = 1000;// 1s times out
WDOG_CS2 = 0x01;
WDOG_CS1 = WDOG_CS1_EN_MASK;
EnableInterrupts;
}
void main(void)
{
WatchDogCfg();
SIM_SOPT = 0X0000000C;//NMIE:when clear,the pin functions as one of its alternative functions
ClockCfg();
PortCfg();
GPIOA_PSOR |= 1<<13;//Light the LED A
for(;;)
{
#if 0 // if I don't feed the dog then the mcu will reset and will light off the LED A
DisableInterrupts;
WDOG_CNT = 0X2A6;
WDOG_CNT = 0X80B4;
EnableInterrupts;
#endif
}
}

So i wonder if it has anything to do with starup_code ——void SystemInit (void) .I find that the watchDog is configurated in it.But UPDATE bit is set,so I think it is ok.
what i have done:
1:WDOG->TOVAL = WDOG_TOVAL_TOVAL(0xE803); /* Timeout value */
——》WDOG->TOVAL = WDOG_TOVAL_TOVAL(1000);
result: the periodic is 51s too;
2:I use my code instead in the void SystemInit (void)
WDOG_CNT = 0X20c5;
WDOG_CNT = 0X28d9;
WDOG_TOVAL = 1000;
WDOG_CS2 = 0x01;
WDOG_CS1 = WDOG_CS1_EN_MASK;
#if 0
#if (DISABLE_WDOG)
/* WDOG->TOVAL: TOVAL=0xE803 */
WDOG->TOVAL = WDOG_TOVAL_TOVAL(0xE803); /* Timeout value */
/* WDOG->CS2: WIN=0,FLG=0,?=0,PRES=0,?=0,?=0,CLK=1 */
WDOG->CS2 = WDOG_CS2_CLK(0x01); /* 1-kHz clock source */
/* WDOG->CS1: EN=0,INT=0,UPDATE=1,TST=0,DBG=0,WAIT=1,STOP=1 */
WDOG->CS1 = WDOG_CS1_UPDATE_MASK |
WDOG_CS1_TST(0x00) |
WDOG_CS1_WAIT_MASK |
WDOG_CS1_STOP_MASK;
#endif /* (DISABLE_WDOG) */
#endif
result: the periodic is 51s too;it looks llike somewhere else what i don't find.
Last is how i load the code into the actrual mcu: I don't configurate anything ,choose 1 and press 2.
Is there any problem?
