Skip to main content
PYada.1
Associate III
December 1, 2021
Question

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

  • December 1, 2021
  • 5 replies
  • 2597 views

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?

This topic has been closed for replies.

5 replies

TDK
Super User
December 1, 2021

> 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""."
Tesla DeLorean
Guru
December 1, 2021

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 VenmoUp vote any posts that you find helpful, it shows what's working..
Frantz LEFRERE
ST Employee
December 2, 2021

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
PYada.1Author
Associate III
December 2, 2021

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
December 2, 2021

Simplest way is to write directly in the register :

WRITE_REG(IWDG->KR, IWDG_KEY_RELOAD);

PYada.1
PYada.1Author
Associate III
December 8, 2021

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.