S32K116 WDOG_Config

cancel
Showing results for 
Search instead for 
Did you mean: 

S32K116 WDOG_Config

Jump to solution
289 Views
rjmalmeida0
Contributor II

Hello,
I'm currently working on the S32K116 Watchdog peripheral and I noticed that the SDK forces the watchdog configuration to enable the 32-bit writes at line 35 as shown below. When I read the manual, it said that it supports both 32-bit and 16-bit writes to unlock/refresh. Is there any reason that the watchdog configuration is always 32-bit enabled?

Regards,
Rui Almeida

status_t WDOG_Config(WDOG_Type * const base,
 const wdog_user_config_t * wdogUserConfig)
{
 status_t status = STATUS_SUCCESS;
 uint32_t cs = base->CS;
 bool tmp1 = WDOG_IsEnabled(base);
 bool tmp2 = WDOG_IsUpdateEnabled(base);
INT_SYS_DisableIRQGlobal();
if ((tmp1 == false) && (tmp2 == true))
 {
 /* Clear the bits used for configuration */
 cs &= ~(WDOG_CS_WIN_MASK | WDOG_CS_PRES_MASK | WDOG_CS_CLK_MASK | WDOG_CS_INT_MASK |
 WDOG_CS_UPDATE_MASK | WDOG_CS_DBG_MASK | WDOG_CS_WAIT_MASK | WDOG_CS_STOP_MASK);
 /* Construct CS register new value */
 cs |= WDOG_CS_WIN(wdogUserConfig->winEnable ? 1UL : 0UL);
 cs |= WDOG_CS_PRES(wdogUserConfig->prescalerEnable ? 1UL : 0UL);
 cs |= WDOG_CS_CLK(wdogUserConfig->clkSource);
 cs |= WDOG_CS_INT(wdogUserConfig->intEnable ? 1UL : 0UL);
 cs |= WDOG_CS_UPDATE(wdogUserConfig->updateEnable ? 1UL : 0UL);
 if (wdogUserConfig->opMode.debug)
 {
 cs |= WDOG_CS_DBG_MASK;
 }
 if (wdogUserConfig->opMode.wait)
 {
 cs |= WDOG_CS_WAIT_MASK;
 }
 if (wdogUserConfig->opMode.stop)
 {
 cs |= WDOG_CS_STOP_MASK;
 }
 /* Reset interrupt flags */
 cs |= WDOG_CS_FLG_MASK;
 /* Enable WDOG in 32-bit mode */
 cs |= WDOG_CS_EN_MASK | WDOG_CS_CMD32EN_MASK;
WDOG_UNLOCK(base);
 /*LDRA_NOANALYSIS*/
 /* The comment LDRA_NOANALYSIS only use to run code coverage */
 while (!WDOG_IsUnlocked(base))
 {
 /* Wait until registers are unlocked */
 }
base->CS = cs;
 base->TOVAL = wdogUserConfig->timeoutValue;
 if (wdogUserConfig->winEnable)
 {
 base->WIN = wdogUserConfig->windowValue;
 }
 /*LDRA_ANALYSIS*/
 /* The comment LDRA_ANALYSIS only use to run code coverage */
while (WDOG_IsUnlocked(base))
 {
 /* Wait until the unlock window closes */
 }
while (!WDOG_IsReconfigurationComplete(base))
 {
 /* Wait until the reconfiguration successful */
 }
 }
 else
 {
 status = STATUS_ERROR;
 }
INT_SYS_EnableIRQGlobal();
return status;
}
Labels (1)
Tags (3)
0 Kudos
1 Solution
175 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Rui,

Please see my comment here:

https://community.nxp.com/message/1305741 

Regards,

Daniel

View solution in original post

0 Kudos
1 Reply
176 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Rui,

Please see my comment here:

https://community.nxp.com/message/1305741 

Regards,

Daniel

View solution in original post

0 Kudos