From 5cff37546cc402e7d5a12567a8d5ca18ebe65a3d Mon Sep 17 00:00:00 2001 From: alfersi <51697530+alfersi@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:22:22 +0100 Subject: [PATCH 1/2] Update ch32v00x_iwdg.c The original condition to check if LSI is Ready (bit LSIRDY set to 1 by hardware in register RSTSCKR) in IWDG_Enable() can never be met, the updated condition works properly and allows for the program to continue execution after calling it --- EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c b/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c index 76c11168..0e3af6f1 100644 --- a/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c +++ b/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c @@ -92,7 +92,7 @@ void IWDG_ReloadCounter(void) void IWDG_Enable(void) { IWDG->CTLR = CTLR_KEY_Enable; - while ((RCC->RSTSCKR)|(0x2)!= SET); + while ((RCC->RSTSCKR)& RCC_LSIRDY != RCC_LSIRDY); } /********************************************************************* From c51f7de7d663344baf82cbb1f50f580b82ce3aac Mon Sep 17 00:00:00 2001 From: alfersi <51697530+alfersi@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:34:45 +0100 Subject: [PATCH 2/2] Update ch32v00x_iwdg.c And mask disambiguation --- EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c b/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c index 0e3af6f1..513ca917 100644 --- a/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c +++ b/EVT/EXAM/SRC/Peripheral/src/ch32v00x_iwdg.c @@ -92,7 +92,7 @@ void IWDG_ReloadCounter(void) void IWDG_Enable(void) { IWDG->CTLR = CTLR_KEY_Enable; - while ((RCC->RSTSCKR)& RCC_LSIRDY != RCC_LSIRDY); + while ((RCC->RSTSCKR & RCC_LSIRDY) != RCC_LSIRDY); } /*********************************************************************