STM32 G0B1KEU6: Using LSI as clock source
I am trying to use the LSI as the clock source on the STM32 G0B1KEU6. It doesn't work, and as soon as I select the LSI in the MUX on the clock tree, my code stops working. To ensure there are no other sources of error, I used the exact same code but with the HSI selected for SYSCLK. Below are the main source files generated by Cube IDE for when LSI is selected and for when HSI is selected (I attached files to this ticket). I also ran a diff to provide more detailed insights and help pinpoint the issue.


Here’s what happens when I try to use the LSI:
First, when I simply download the program to the STM32 without using debug mode, I get the exact same output in the console.

Then, to understand where the code fails, I enter debug mode and step through the code line by line. Here’s where it fails:




The issue occurs at line 907, which I believe is where the code selects the LSI as the SYSCLK source.
All the code is entirely generated by CubeIDE, except for the parts where I set and clear the debug pins and inside the while(1) loop.
So my question is: how do you configure the LSI as the SYSCLK source, and why is Cube IDE generating code that doesn’t work? Did I miss something?
Thank you for your help
Karine
