2023-09-02 11:07 PM - last edited on 2023-09-06 12:55 AM by KDJEM.1
I implemented IWDG reset having counter of 12 second and am refreshing it using HAL_IWDG_Refresh(&hiwdg) in while loop.
Everything is working as expected. But now the issue is when I implement sleep mode.
The processor will be in sleep and wakeup by interrupt. So if processor doesn't wakeup within 12 second then HAL_IWDG_Refresh will not be executed.
2023-09-03 12:12 AM
What do you want to happen?
How might you distinguish between stuck crashed asleep and operating correctly asleep?
One approach would be to have a periodic wakeup driven by a timer or the RTC, when you do a quick health-check and if things are good then refresh the watchdog.
Another approach would be to stop the watchdog from running, but for that you need to go through a reset cycle. So your startup-from-reset code would have to distinguish between intentional-reset-to-stop-watchdog-prior-to-sleep and reset-to-start/operate-normally.
2023-09-03 01:05 AM
Hello @Nico3
I think that you should use a timer to interrupt every 12s and add the HAL_IWDG_Refresh function to the TIMER interrupt function to make sure that the command is executed directly after the wake-up from sleep mode using the TIMER interruption.
Hope this is helpful. If your question is answered please check this answer as best answer to be diffused.
Best regards.
II
2023-09-03 03:30 AM
Dear Danish,
I would prefer to implement first option.
"One approach would be to have a periodic wakeup driven by a timer or the RTC, when you do a quick health-check and if things are good then refresh the watchdog"
Please suggest how to do quick health check as you suggested.
2023-09-05 08:28 AM
2023-09-05
03:21 PM
- last edited on
2023-09-06
06:18 AM
by
Lina_DABASINSKA
The code in knowledge base article you linked has all of those flaws. Does ST think it is OK to present everywhere a completely broken code, ignore almost all of the bug reports and pretend all of those issues do not exist?
2023-09-06 02:59 AM
I didn't create this topic, apparently @KDJEM.1 did. It was a post there:
https://community.st.com/t5/stm32-mcus-embedded-software/implementing-iwdg-in-sleep-mode/m-p/587178
In addition I don't think this should be a separate topic, because all of the issues already are reported in the three linked topics. Also the title "Re: Implementing IWDG in sleep mode" is now not appropriate and, of course, it is pre-pended with the useless/harmful e-mail style "Re: " stupidity.
@Lina_DABASINSKAITE , what is going on here?
2023-09-06 03:27 AM
Hello @Piranha ,
Sorry for the wrong action on my side. I will move back this thread to the original discussion.
Please note that the mentioned questions are under investigation to tack a relevant actions.
Thank you.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-09-06 07:38 AM
Please note that the mentioned questions are under investigation to tack a relevant actions.
You mean like this documentation issue? In 4 years ST still has not been able of even fixing a few sentences in documentation. Not even a code!
Or you mean like this severe bug? The fix is trivial, I even gave an example and it takes just a few minutes to implement it. Instead ST appointed some incompetent fool to it, who just blurted out a complete nonsense and dismissed the issue altogether.
And do I have to remind that all of the code created by HAL/Cube team is full of hundreds of bugs, which have not been fixed for years and are still ignored? Some 80% of reports are ignored completely, 10% are reported internally, 5% are tried to fix and about 1% are actually fixed... years later! The same is true for examples. And even the knowledge base articles, which present a code examples, present a broken code!