Indipendend Watchdog on stm32f0

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Oscar_T
Posts: 89
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Indipendend Watchdog on stm32f0

Post by Oscar_T »

Hi

I am trying to implement IWDG timer within the program.

In a previous post LeighM you indicated how to activate the watchdog.

Code: Select all

// 1. Enable the IWDG by writing 0x0000 CCCC in the IWDG_KR register.
IWDG->KR = 0xCCCC;
// 2. Enable register access by writing 0x0000 5555 in the IWDG_KR register.
IWDG->KR = 0x5555;
// 3. Write the IWDG prescaler by programming IWDG_PR from 0 to 7.
IWDG->PR = 7;
// 4. Write the reload register (IWDG_RLR).
IWDG->RLR = 0xFFF;
// 5. Wait for the registers to be updated (IWDG_SR = 0x0000 0000).
while (IWDG->SR);
// 6. Refresh the counter value with IWDG_RLR (IWDG_KR = 0x0000 AAAA)
IWDG->KR = 0xAAAA;
I tried to enter the code and readjust it to make the timer be 1 second, but it resets first instead.

Am I doing something wrong in the formula?
Attachments
watchdog.fcfx
(10.32 KiB) Downloaded 304 times
iwdg.png
iwdg.png (476.03 KiB) Viewed 2956 times

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: Indipendend Watchdog on stm32f0

Post by LeighM »

Hi,
I think the main issue is that the watchdog reset commands

Code: Select all

IWDG->KR = 0xAAAA;
have been placed in a Calculation icon,
they should be in a C icon

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: Indipendend Watchdog on stm32f0

Post by Oscar_T »

Hi LeighM

Many thanks

Post Reply