Skip to content

Conversation

@alfersi
Copy link

@alfersi alfersi commented Feb 3, 2024

IWDG_Enable in ch32v00x_iwdg.c of the peripheral library has a bug while checking if the bit LSYRDY of the RSTSCKR register is set by waiting endlessly for it to be set with a condition impossible to meet:

while ((RCC->RSTSCKR)|(0x2)!= SET);

The correct way should be:

while ((RCC->RSTSCKR & RCC_LSIRDY)!= RCC_LSIRDY);

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
And mask disambiguation
@blu006
Copy link

blu006 commented Mar 27, 2024

I also noticed this bug when the compiler pointed me to it after I turned on -Wall

kholia pushed a commit to kholia/ch32v003 that referenced this pull request Jul 11, 2024
Better way to handle Windows linking to the right libgcc.a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants