Watchdog unlock not working - FS32K146

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

Watchdog unlock not working - FS32K146

Jump to solution
1,504 Views
Farnam
Contributor II

I'm using the chip FS32K146UAT0VLHR.

It seems to be unresponsive to commands to unlock the watchdog.

I write:
WDOG -> CNT = 0xD928C520;

... but the register value for 'ULK' does not toggle to 1.

Then moving forward I get stuck in the check contained in wdog_hw_access.h:

static inline bool WDOG_IsUnlocked(const WDOG_Type * base) {
return ((base->CS & WDOG_CS_ULK_MASK) >> WDOG_CS_ULK_SHIFT) != 0U;
}

Seen a few other forum posts that make me think this might be an issue with the chip. Any ideas?

0 Kudos
Reply
1 Solution
1,478 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Farnam

1.First make sure you already enabled the UPDATE bit:

Senlent_0-1709001680745.png

2.Make sure CMD32EN is enabled if you're using 32-bit refresh/unlock command write words.

Senlent_1-1709001800048.png

The configuration update unlock sequence of the WDOG watchdog of the S32K1xx sequence MCU must be written within 16 bus cycles, and after unlocking, the configuration update of the WDOG watchdog must be completed within 128 bus clock cycles, otherwise the unlock window will automatically Off; therefore, the CPU core global interrupt needs to be turned off when unlocking and completing configuration updates

DisableInterrupts; //disable global interrupt
WDOG_CNT = 0xD928C520; //unlock watchdog
while(WDOG_CS[ULK]==0); //wait until registers are unlocked
WDOG_TOVAL = 256; //set timeout value
WDOG_CS = WDOG_CS_EN(1) | WDOG_CS_CLK(1) | WDOG_CS_INT(1) | WDOG_CS_WIN(0) | WDOG_CS_UPDATE(1);
while(WDOG_CS[RCS]==0); //wait until new configuration takes effect
EnableInterrupts; //enable global interrupt

View solution in original post

3 Replies
1,454 Views
Farnam
Contributor II

Hi @Senlent,

Thank you for the prompt answer.

Taking a step back for a moment...
I'm using Design Studio for ARM version 2.2 and the SDK/development packages are version 2.2.
When checking for updates in the IDE, these appear to both be the most current.
However, the functions contained within, ie: `WDOG_DRV_Init()` does not appear to write the correct register values to enable and unlock the WDOG:

WDOG -> CNT = 0xD928C520; // Unlock
WDOG -> CS = 0x00002100; // Enable

It's not in the autogen file that goes into `Generated_Code`, from the GUI configuration either.

The functions work for the most part, but this portions need to be done manually, and the headers for the WDOG API mention 2015 which seems to pre-date the S32K lineup entirely.

On that note, even when I enable the debug mode for WDOG, I can never see the `ULK (bit11)` toggle to 1... indicating the WDOG is unlocked. However, it does seem to work when I flash the code onto the board.

I guess the questions in part are:
- Should I be able to just use the SDK API for the S32K146 to implement the WDOG?
- Is it possible to debug the WDOG in full, in debug mode?
Please share any other ideas and thoughts you have as well.
Thank you.

0 Kudos
Reply
1,433 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Farnam

the SDK version I'm using is RTM 3.0.0 and the routine name is wdog_interrupt_s32k146

Senlent_0-1709173023715.png

 

 

1,479 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Farnam

1.First make sure you already enabled the UPDATE bit:

Senlent_0-1709001680745.png

2.Make sure CMD32EN is enabled if you're using 32-bit refresh/unlock command write words.

Senlent_1-1709001800048.png

The configuration update unlock sequence of the WDOG watchdog of the S32K1xx sequence MCU must be written within 16 bus cycles, and after unlocking, the configuration update of the WDOG watchdog must be completed within 128 bus clock cycles, otherwise the unlock window will automatically Off; therefore, the CPU core global interrupt needs to be turned off when unlocking and completing configuration updates

DisableInterrupts; //disable global interrupt
WDOG_CNT = 0xD928C520; //unlock watchdog
while(WDOG_CS[ULK]==0); //wait until registers are unlocked
WDOG_TOVAL = 256; //set timeout value
WDOG_CS = WDOG_CS_EN(1) | WDOG_CS_CLK(1) | WDOG_CS_INT(1) | WDOG_CS_WIN(0) | WDOG_CS_UPDATE(1);
while(WDOG_CS[RCS]==0); //wait until new configuration takes effect
EnableInterrupts; //enable global interrupt