2023-07-13 08:45 AM
I use STM32CubeIDE 1.13.0 to generate code for NUCLEO-L476RG.
The generated SystemClock_Config() put flash latency configuration after the clock configuration. I don't know why it works for the first call, but if I call it after exiting stop mode, it make some weird error.
If i put the flash latency configuration after the voltage configuration and before clock configuration, it works correctly.
Is there a reason to put the flash latency configuration after the clock configuration ?
Would it be better to generate code that put the flash latency configuration before the clock configuration so we can use the same function for exiting stop mode ?
Solved! Go to Solution.
2023-07-17 02:04 AM
2023-07-14 03:15 AM
Hello @nicolas,
>>but if I call it after exiting stop mode, it makes some weird error.
Could you please specify/show the error
Actually, when changing the CPU frequency, depending on increasing or decreasing it, there is a software sequence that must be applied in order (check RM0411, the Read access latency section also PWR Control section 5.1.8)
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-07-14 04:26 AM
IIRC, sometime it was hardfaulting, sometime closing my debugger.
I didn't found the RM0411, but i found the RM0351 instead.
There is also a sequence chapter 3.3.3. But the problem is the code generated by ST tools doesn't follows those sequence so it can sometime fail.
2023-07-14 10:05 AM
Apparently my error is similar to this one
I was wrongly thinking it was from flash config. My program crash only when i'm using a clock of 64 MHz or higher but works with 56 MHz.
2023-07-17 02:04 AM