STM32CubeMX 6.8.0 and STM32CubeIDE 1.12.0: bug in the use of LL
Currently, STM32CubeMX 6.8.0, including the one used in CubeIDE, generates an incorrect comparison when using the low layer library (LL) for reset and clock control (RCC) in a project. This happens when you change the peripheral module RCC from HAL to LL in Project Manager > Advanced Settings by clicking on the relevant line and then selecting LL.
void SystemClock_Config(void)
{
LL_FLASH_SetLatency(LL_FLASH_LATENCY_1);
while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_1)
{
}
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE***);
while (LL_PWR_IsActiveFlag_VOS() == 0) // <-- to be corrected
{
}Explanation:
LL_PWR_SetRegulVoltageScaling() sets bits VOS in PWR_CR1,
LL_PWR_IsActiveFlag_VOS() checks the corresponding bit VOSF in PWR_SR2:
Typically, the return value 0 stands for OK or HAL_OK, so LL_PWR_IsActiveFlag_VOS() returns the correct value, but STM32CubeMX inserts the wrong comparison so that the while loop is never exited on OK.
Temporary fix until this is corrected: after each generation of the code by STM32CubeMX, the mentioned comparison in SystemClock_Config() has to be corrected manually from == 0 to !=0 (line 8 in the snippet mentioned above).
We are very sorry if this is causing you any inconvenience at the moment. We will fix the problem as soon as possible.
