cpu/stm32u5: Fix LSI initialization#22239
Conversation
|
Hello, thank you for your PR, can you give more detailed testing procedures how one might properly - test this PR, the current description of the testing procedure sounds more like your expected result with this PR than how to replicate it properly. Thank you so much for your contribution! |
|
the old code was probably not tested from the stm32u5 reference manual :
i think this confirms the change @flxmls: please fix commit message and PR message https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#commit-conventions note for future work: instead of redfining bit names to old names and then write to the old register #if defined(RCC_BDCR_LSION)
RCC->BDCR |= RCC_BDCR_LSION;
while (!(RCC->BDCR & RCC_BDCR_LSIRDY)) {}
#elif defined(RCC_CSR_LSION)
RCC->CSR |= RCC_CSR_LSION;
while (!(RCC->CSR & RCC_CSR_LSIRDY)) {}
#elif defined(RCC_CSR2_LSION)
RCC->CSR2 |= RCC_CSR2_LSION;
while (!(RCC->CSR & RCC_CSR_LSIRDY)) {}
#else
#warn "i got not clue where LSIon is for this CPU"
#endif |
cpu/stm32/stmclk: fix RCC register selection for STM32U5
|
Thank you so much for your help. I've changed the commit message. I hope it's okay now. |
seems like it is still the old message:
the title of this pr now gives a good hint how the title of the commit should look like -- the title hidden in your commit description is also good -- ahh i see is your current commit message -> you need to remove the first line that title is OK |

To enable the LSI oscillator on STM32U5, RCC_CSR was used instead of RCC_BDCR, which is the correct register.
Contribution description
After clearing the reset status flags, the program got stuck in the LSIRDY loop on the next restart. After checking the reference manual, I identified that the wrong register was being used. Once the register was corrected, the program ran as expected.
Testing procedure
I wrote a simple watchdog code where the watchdog triggers a reset.
Issues/PRs references
None
Declaration of AI-Tools / LLMs usage:
AI-Tools / LLMs that were used are: