IWDG of STM32F103 work in hardware watchdog mode, question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 4:02 PM
IWDG of STM32F103 work in hardware watchdog mode, by set MCU's option bytes.
​
My question is "Once the option byte wrote, software need not start the IWDG by code, even after many times reset ( include software reset , PVD reset, IWDG reset) IWDG is still functional.
here is my code for setting the option byte of IWDG to hardware watchdog mode.
***************************
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();
}
**************************
- Labels:
-
IWDG-WWDG
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 4:11 PM
After EMC shocks, my PCB frozen , looks like IWDG is not functional.
In the task of feed IWDG, I turn on and turn off a LED indicator, so I can sure nobody feed the IWDG
**********************************
IWDG->KR = ((uint16_t)0xAAAA);
iWdgCnt++;
​
if( iWdgCnt == 5)
{
GPIO_ResetBits(LED_PORT, LED_PIN1);
}
else (iWdgCnt == 10)
{
GPIO_SetBits(LED_PORT, LED_PIN1);
iWdgCnt = 0;
}
*************************************
thank you for the advice​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 4:16 PM
Does an External reset button recover it, or do you have to cycle the power to recover from the latch-up?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 5:17 PM
So sorry, there is no reset button on my design. Currently I have to cycle the power to recover
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 6:46 PM
It would have been a way to double check. The IWDG can only pulse the reset, and if that doesn't break the condition you are dead in the water.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 7:22 PM
ok...... Clive
Do you the code for "set the option byte of IWDG hardware watchdog mode" is right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-27 7:42 PM
Is there any other condition IWDG not functional, except SWD debug? Like standby mode / sleep or something else, for stm32f103 chips?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-28 1:56 AM
> In the task of feed IWDG, I turn on and turn off a LED indicator, so I can sure nobody feed the IWDG
I wouldn't rely on human eye in this. Runaway software may behave in unexpected ways, e.g. timing you are accustomed to may not work correctly. Use oscilloscope or logic analyzer to observe this pin.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-28 4:11 AM
JW,
> Runaway software may behave in unexpected ways
Nice advice, I will do some trouble shooting by oscilloscope or logic analyzer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-28 4:23 AM
JW, one more question.
Enalbe LSI, and reconfig IWDG should not STOP running IWDG, right?
On ST's comments, IWDG started, software can not stop it by any way.
**********************************************
RCC_LSICmd(ENABLE);
while( RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET )
{
LSI_CNT++;
if( LSI_CNT > 100) break;
}
..................
..................
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
//40K/256 = 156HZ(6.4ms)
IWDG_SetPrescaler(IWDG_Prescaler_256);
//150 * 6.4 about 960ms
IWDG_SetReload(150);
IWDG_Enable();
IWDG_ReloadCounter();
**************************************
