2021-02-01 02:01 AM
Hello everyone,
I am currently extending a legacy software, for STM32 ;
it is for : "stm32f103cb", with Atollic TrueStudio 9.3
I want to add IWDG (independent watchdog) ; to do so I generated a new project using CubeIDE, latest version, driven by a proper youtube tutorial on IWDG and STM32.
Then I manually copied the needed code into my existing project.
My question is :
is it enough to copy only the C code, into the existing project, to get the IWDG properly working ?
Or there is additional setup to be done that cannot be copied this way ?
Thank you in advance.
Solved! Go to Solution.
2021-02-01 07:03 PM
Copying the relevant init code from main.c and the library .c + .h files. Search for IWDG in the whole new project.
If both, the old and the new project use the same libs (HAL?), it should work. If not, let CubeIDE import (a copy of) the old project.
2021-02-01 07:03 PM
Copying the relevant init code from main.c and the library .c + .h files. Search for IWDG in the whole new project.
If both, the old and the new project use the same libs (HAL?), it should work. If not, let CubeIDE import (a copy of) the old project.
2021-02-02 01:00 AM
Thank you, KnarfB, for the quick answer ; i will do this eway ;
not immediately, due to my target environment issues... ( I omit all the details... :).
One detail : my STM32 is embedded into a mainboard, and it is not easy to test the Software and detect if the watchdog really performs the reset or not.
We have to toggle some pins, and read the voltage on those pins . . . . it takes time...
(I do not have, on my desk, an evaluation board, but I am seriously thinking of buying it)
Anyway, I will let you know.
Thanks.
2021-02-04 01:36 AM
Hello everyone, I made a first test, using only the pasted code ;
I avoided refreshing the watchdog, so to cause a reset, but the reset did not happen.
I was using the debugger : maybe this could be an issue ?
I knew that a working watchdog works ALSO during a debugging session, also when a breakpoint has been hit.
I will go on trying to generate a minimal SW that uses the Watchdog, and really performs the reset of my STM32.
Only then, I w8ill try to port this code into my ful original SW.
2021-02-13 10:47 AM
Hello everyone,
Not only, thje watchdog does not reset the STM32 ;
but, in the whole project, as soon as i call the refresh function of the HAL ( HAL_IWDG_Refresh )
the result code is : HAL_TIMEOUT
Then, the software becomes unable to send and receive data over the serial port.
The remaining tasks of the SW seem to continue working correctly.
But the correct working of the serial port is gone.
It seems to me an incorrect setup , at the beginning.
Should I try first a simple standalone program to setup the watchdog ?
Thank you.
2021-02-18 03:43 AM
Also standalone program does not work.
Do you want to hear about "WHY" watchdog seemed to be not working ?
Because there was a missing line of code ;
cubeMX does not write the following needed line of code :
HAL_IWDG_Start(&hiwdg) ;
Cube MX 4.27 does not write this line.
But also latest version, 6.1.1, does not.
I discovered this, by looking directly into the source code of the HAL library.
is this . . . normal ???
Now the independent watchdog is smoothly working.