cancel
Showing results for 
Search instead for 
Did you mean: 

How to feed watchdog from an application which is started in bootloader

PYada.1
Associate III

I am using STM32L562E-DK for my development. I have ported SBSFU for it.

I want to add watchdog functionality to it. Currently, I am initializing the watchdog (window) from the application and feeding it from Freerto's task in the application.

Now, I want to init the watchdog in the bootloader and feed it from the application.

For another interface (e.x. timer) we need to deinit the timer in the bootloader before jumping to the application if the same timer is used in the application. As watchdog doesn't have deinit functionality, is it possible to use watchdog from an application that is initialized in bootloader?

@Frantz LEFRERE​ , Can you please help me regarding it?

6 REPLIES 6
TDK
Guru

> is it possible to use watchdog from an application that is initialized in bootloader?

Yes. The procedure to reset the watchdog is the same regardless of where/who starts the watchdog.

If you feel a post has answered your question, please click "Accept as Solution".

The watchdog behaves the same, you'd kick it in exactly the same way.

One issue is when to enable it, as flash erase/write operations can stall the MCU, so if the loader implements updates be cognizant of what time certain operations consume.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Frantz LEFRERE
ST Employee

In fact the X-SBSFU package have an implementation of watchdog protection but this has not been put in place in the SBSFU cortex M33.

PYada.1
Associate III

Thanks @TDK​ , @Community member​  and @Frantz LEFRERE​ , for your input,

TO init watchdog I can use HAL_WWDG_Init(&hwwdg) to init. But in the application how I will be able to get the context of initialized watchdog hwwdg in the application?

As HAL_WWDG_Refresh(&hwwdg), Can I use the same configuration and without init If I call HAL_WWDG_Refresh(&hwwdg) API will it refresh the watchdog counter?

Frantz LEFRERE
ST Employee

Simplest way is to write directly in the register :

WRITE_REG(IWDG->KR, IWDG_KEY_RELOAD);

PYada.1
Associate III

Thanks @Frantz LEFRERE​ , @TDK​ ,@Community member​  for your input. I am able to init window watchdog from bootloader and able to feed it from the application.