2014-08-15 06:55 AM
Hello,
I am having a weird problem with Independent Watchdog timer in my STM32F051K8. Here is my initialization:IWDG ->KR = 0x00005555;IWDG ->PR = 0;IWDG ->RLR = 0x000003FF; // Reload value 1023*(1/(40kHz/4)) = 0.1sIWDG ->KR = 0x0000AAAA; // reload the counter with RLRIWDG ->KR = 0x0000CCCC; // Enable downcount of IWDGEvery 20ms, if I still see my input signals, I will reset watchdog counter. If I don't, watchdog should reset the MCU every 0.1sThis code works fine in my 1st project. I am working on 2nd project, and most of the time, my watchdog doesn't do anything. Sometimes it behaves like this:Power on -> reset after 3+ minutes -> reset after a few seconds -> reset every 0.1s (as expected)I am thinking about my supply circuit, the schematic is a little bit difference between 2 projects. Are there any strict rules in powering up an MCU, so the clocks can work correctly? (I am using 8 MHz HSI clock)Any suggestions about where I should look into would help. (brown out protection, schematic design, clocks initialization, etc.)Also when the watchdog is not working, other peripherals work just fine. I can communicate through USART and run my motors.Thank you.2015-11-12 08:24 AM
Hi pham.thai,
I have the same behaviour, but with a periodic reset of ~3.41s caused by the IWDG. my prescaler is set to 32 and my reload register to 19. Did you find the source of this problem?Thanks,