cancel
Showing results for 
Search instead for 
Did you mean: 

iwdg hardware mode not working.

lzyos
Associate II

I wanna my design can back to working after EMC shocks.

So I plan to use Hardware watchdog , with followed code under ucOS

***************************

usrOption = FLASH_GetUserOptionByte();

if( (usrOption&OB_IWDG_SW) != 0)

{

FLASH_Unlock();

FLASH_EraseOptionBytes();

FLASH_UserOptionByteConfig(OB_IWDG_HW,OB_STOP_NoRST,OB_STDBY_NoRST);

FLASH_Lock();

OSTimeDlyHMSM(0, 0, 1, 0);

OS_ENTER_CRITICAL();   

NVIC_SystemReset();

OS_EXIT_CRITICAL();

}

**************************

99% iwdg work fine. But under some bad situation, my system frozen , looks like iwdg not working.

Can someone give me some advise, ​ why sometime IWDG out of service, is there any way to sure IWDG can work fine even under very bad situation.

3 REPLIES 3

> my system frozen , looks like iwdg not working

Are you sure that "frozen system" is result of IWDG not working? Have you observed the NRST pin's behaviour?

> So I plan to use Hardware watchdog , with followed code under ucOS

An extremely bad plan. Hardware watchdog ought to act as directly as possible, i.e. directly on hardware, software involved only as a secondary action (e.g. logging).

JW

lzyos
Associate II

JW, thank you for your reply.

NRST pin is connected to the GND through a 100nf capacitance, No button or something else connected on the NRST pin.

> So I plan to use Hardware watchdog , with followed code under ucOS

>An extremely bad plan. Hardware watchdog ought to act as directly as possible, i.e. directly on >hardware, software involved only as a secondary action (e.g. logging).

Sorry my word not clear, I mean I wanna " use iwdg module of STM32f103 in hardware watchdog mode", is the code right for "start iwdg module of stm32f103 as hardware watchdog"?

thank you for your advice.

No, I meant, observe the NRST pin using oscilloscope or logic analyzer, to find out whether the watchdog did or did not invoke the reset.

"Frozen system" is a description which may hide many confusing states. For example, in systems, where the primary interaction is through a display, if that display has a standalone controller, if it resets in an EMC event without the rest of the system being reset, may be seen by the observer as a "frozen system" (as display goes blank or the last displayed picture stays on "forever", or similar surprising effect), while the rest of the system continues to work normally (including restarting the watchdog), unaware of this effect. Similarly, for example if the EMC event for results in inadvertent reconfiguration of the GPIO registers, the system may continue to work unaffected, except that it won't react on buttons presses anymore, which again can be described as "frozen system", if primary input comes from GPIO inputs. You surely can think of many similar ways how things can go wrong.

Safeguarding is complex in that there's no single and definitive solution and simple guidelines, and every system has its uniques ways to fail, which all have to be considered and taken care for.

JW