S32k144 jumps to app through bootloader, watchdog cannot start correctly

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

S32k144 jumps to app through bootloader, watchdog cannot start correctly

1,157 Views
jinyun1984
Contributor I

Hello,

      I am writing a bootloader in s32k144 to jump to the app and start the watchdog process in the app. In bootloader, I use the function WDOG_DRV_Deinit() to stop watchdog. Then bootloader will jump to app program and configure watchdog in app program. But after the jump, watchdog can be configured successfully, but it can't be started all the time. There has been no dog feeding in the program and the program has not been restarted. Through the function WDOG_DRV_GetCounter(), I can see that the count value is always 0. And the watchdog driver I use is the library function of S32 DS. Why is that?

0 Kudos
6 Replies

937 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello jinyun1984@126.com,

Could you please read the WDOG_CS register in the S32 Design Studio when you halt the application?

Thanks,

BR, Daniel

0 Kudos

937 Views
jinyun1984
Contributor I

When the program jumps from bootloader to application program, CS value is 8848, and enable bit value is 1. But I have used WDOG_DRV_Deinit()  function in bootloader to stop the watchdog。And it's useless for me to stop the watchdog by using WDOG_DRV_Deinit()  function in the application.

0 Kudos

937 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello jinyun1984@126.com,

Is this what you see?
CS = 8848 = 0x2290‬
CMD32EN = 0b1,
CLK = 0b10 INTCLK (internal clock),
EN = 0b1,
UPDATE = 0b0,
TST = 0b10 (Watchdog test mode enabled, only the low byte is used).

If so, updates are not allowed.

What is your initial configuration of the WDOG?
Do you enable updates?

What is the return status of the WDOG_DRV_Deinit() function?
I guess there is STATUS_ERROR.

Is SOSC_CLK enabled in the application?

Thanks,
BR, Daniel

0 Kudos

937 Views
jinyun1984
Contributor I

The configuration of watchdog is the same in bootloader and application:

wdog_user_config_t watchdog1_Config0 = {
.clkSource = WDOG_LPO_CLOCK,
.opMode = {
false, /* Wait Mode*/
false, /* Stop Mode*/
false /* Debug Mode*/
},
.updateEnable = true,
.intEnable = false,
.winEnable = false,
.windowValue = 0,
.timeoutValue = 6400,
.prescalerEnable = false
};

You are right. The return value of WDOG_DRV_Deinit() function is indeed STATUS_ERROR.

SOSC_CLK  has been enabled. The configuration is as follows:

.soscConfig =
{
.initialize = true, /*!< Initialize */
.freq = 8000000U, /*!< Frequency */
/* SOSCCSR */
.monitorMode = SCG_SOSC_MONITOR_DISABLE, /*!< SOSCCM */
.locked = false, /*!< LK */
/* SOSCCFG */
.extRef = SCG_SOSC_REF_OSC, /*!< EREFS */
.gain = SCG_SOSC_GAIN_LOW, /*!< HGO */
.range = SCG_SOSC_RANGE_MID, /*!< RANGE */
/* SOSCDIV */
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SOSCDIV1 */
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SOSCDIV2 */
},

The problem now is that if my application is launched directly from the 0 address of flash without bootloader, the watchdog has no problem at all. But you can't use bootloader to jump over. Which configuration is wrong?

0 Kudos

937 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello 一军 王,

It's hard to say, but your configuration does not match what your read in the WDOG_CS register. 

Please monitor the register at the start of the bootloader and after each WDOG init/deinit function. 

The deinit() function returns STATUS_ERROR if the updates are not allowed.

BR, Daniel

0 Kudos

937 Views
jinyun1984
Contributor I

Hello Daniel martynek,

      Now the problem has been solved. I used the WDOG_DRV_Deinit() function in the application program and added a delay, but the register CS status bit is always wrong. Now I extend the delay after this function, and the watchdog can be used normally now. Thank you very much for your answers.

0 Kudos