2022-06-28 01: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.
2022-06-28 02: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).
2022-06-28 01:48 AM
2022-06-28 02: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).
2022-06-29 02: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: