2023-11-27 11:02 AM - edited 2023-11-27 11:19 AM
Hello,
My MCU is STM32L053R8
I use freeRTOS project generated by CubeMX.
The problem is happening only when I enable tickless sleep. I get only one correct reading, which is probably generated right after MX_RNG_Init. Then after the sleep, I always get `LL_RNG_IsActiveFlag_CECS(RNG) == 1`
I call `LL_RNG_Enable(RNG)` and `LL_RNG_Disable(RNG)` before and after `LL_RNG_ReadRandData32()`
It looks like HSI does not start after the sleep. In the documentation I found that it is indeed deactivated if there is no periphery connected which can run in stop mode. But I did not find, how it should be started properly.
Solved! Go to Solution.
2023-11-27 12:27 PM
HSI can be enabled with:
__HAL_RCC_HSI_ENABLE();
2023-11-27 12:27 PM
HSI can be enabled with:
__HAL_RCC_HSI_ENABLE();
2023-11-27 10:41 PM
@TDK thanks for the hint. It was a bit more complicated. The configuration of PLL has to be also done again:
// make sure HSI is on
if (!LL_RCC_HSI_IsReady()) {
LL_RCC_HSI_Enable();
while(LL_RCC_HSI_IsReady() != 1)
{
}
LL_RCC_HSI_SetCalibTrimming(16);
}
if (!LL_RCC_PLL_IsReady()) {
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, LL_RCC_PLL_MUL_3, LL_RCC_PLL_DIV_2);
LL_RCC_PLL_Enable();
while(LL_RCC_PLL_IsReady() != 1)
{
}
}
Now it works, thanks again!