[SOLVED] watchdog How to calculate the time ?

Post here first, or if you can't find a relevant section!
Post Reply
acronis
Posts: 143
Joined: Thu Mar 02, 2017 12:32 pm

[SOLVED] watchdog How to calculate the time ?

Post by acronis » Wed Nov 08, 2017 1:25 pm

Hello.

In my program the watchdog timer .
Tell me how is the time in iwdg_init.
I need to record the maximum time for STM32F407VET6.

I don't know how to count, what frequency ?
Last edited by acronis on Wed Nov 08, 2017 1:45 pm, edited 1 time in total.

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: watchdog How to calculate the time ?

Post by stevestrong » Wed Nov 08, 2017 1:41 pm

Look here: https://github.com/rogerclarkmelbourne/ ... iwdg.h#L32

The time is computed by multiplying (1/40kHz) by the (prescaler * reload) value.
So if you want 1 ms timeout, you use (IWDG_PR_DIV_4, 10) which means (1/40kHz) = 25µsec * (4*10=40) = 1 millisecond.
For 1 second you can use (IWDG_PR_DIV_4, 10000), or any (allowable) combination which yields a total multiplier of 40000.

acronis
Posts: 143
Joined: Thu Mar 02, 2017 12:32 pm

Re: watchdog How to calculate the time ?

Post by acronis » Wed Nov 08, 2017 1:45 pm

Thank you !!!

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [SOLVED] watchdog How to calculate the time ?

Post by stevestrong » Wed Nov 08, 2017 1:47 pm

Don't forget to periodically call

Code: Select all

iwdg_feed();
before the timeout runs out.

acronis
Posts: 143
Joined: Thu Mar 02, 2017 12:32 pm

Re: [SOLVED] watchdog How to calculate the time ?

Post by acronis » Wed Nov 08, 2017 1:59 pm

Yes, Yes, I do.

I just needed to calculate the maximum possible delay watchdog timer for STM32F407

Post Reply