cancel
Showing results for 
Search instead for 
Did you mean: 

Watchdog timer is not working properly - STM32F051K8

thaip
Associate
Posted on August 15, 2014 at 15:55

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.1s

IWDG ->KR = 0x0000AAAA;     // reload the counter with RLR

IWDG ->KR = 0x0000CCCC;             // Enable downcount of IWDG

Every 20ms, if I still see my input signals, I will reset watchdog counter. If I don't, watchdog should reset the MCU every 0.1s

This 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.
1 REPLY 1
ismail
Associate
Posted on November 12, 2015 at 17:24

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,