Sometimes, WWDG was not working and CPU hang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-28 1:07 AM
My company uses the STM32G0071CB chip. but I faced some issue.
whenever I need to reboot main board, I have to reset the STM32G0071CB as wells.
so I used the WWDG for resetting the chip.
But sometimes, chip was not reset and CPU hang.(once a 400 times or randomly happen it)
I used the below code for initializing and resetting.
I didn't find anything wrong in my code.
Could you please give me any guide?
Thank you for your support in advanced.
= Code =
void Init_WWDG(void)
{
/* Enable the peripheral clock WWDG */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG);
LL_WWDG_SetPrescaler(WWDG,LL_WWDG_PRESCALER_8); /* (1) */
LL_WWDG_SetWindow(WWDG,0x7E); /* (2) */
LL_WWDG_SetCounter(WWDG, 0x7E); /* (3) */
}
void Reset(void)
{
SCB->VTOR = 0x0; // Reset the Vector Table back to the bootloader
FLASH->CR |= FLASH_CR_LOCK_Msk;
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG);
LL_WWDG_SetPrescaler(WWDG, LL_WWDG_PRESCALER_8);
LL_WWDG_SetCounter(WWDG, 1);
LL_WWDG_Enable(WWDG);
}
Solved! Go to Solution.
- Labels:
-
IWDG-WWDG
-
STM32G0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-28 2:20 AM
What if interrupt hits after line 13? Does some interrupt handler in your bootloader kick the WWDG?
Try to disable interrupts before line 13 (IMHO it isn't needed at all).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-28 1:48 AM
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-28 2:20 AM
What if interrupt hits after line 13? Does some interrupt handler in your bootloader kick the WWDG?
Try to disable interrupts before line 13 (IMHO it isn't needed at all).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-29 2:33 AM
Hi @Pavel A.​ ,
Thank you so much. your right. The reset vector table is different bootloader and app.
so After setting the address of vector table to '0', If systick interrupt is happen, It cause the unhandled exception error.
If I disable the all irq before line 13, It is working fine.
Thank you for your support again:thumbs_up:
