I use the STM32L152RE device with STM32Cube_FW_L1_V1.8.0
Please, can you verify if there is problem in defining the values of the bits VOS[1:0], which are defined in the manual of STM32L100xx, STM32L151xx, STM32L152xx and STM32L162xx advanced ARM ® -based 32-bit MCUs (RM0038 Reference manual) as follows:
- 00: forbidden (bits are unchanged and keep the previous value, no voltage scaling range changed);
- 01: 1.8 V (range 1);
- 10: 1.5 V (range 2);
- 11: 1.2 V (range 3).
In fact, when I tried to execute __HAL_PWR_VOLTAGESCALING_CONFIG function with PWR_REGULATOR_VOLTAGE_SCALE3 (VOS=11), the execution failed. After resetting to 00(VOS=00), the execution succeed. Please, can you verify if the values of VOS should be definedas follows:
- 00: 1.8 V (range 1);
- 01: 1.5 V (range 2);
- 10: 1.2 V (range 3);
- 11: forbidden (bits are unchanged and keep the previous value, no voltage scaling range changed).
As shown in the following print screen, I added other printf after the next instructions. But, the message before __HAL_PWR_VOLTAGESCALING_CONFIG function appears, while other messages does not appear. It means that all instructions before this function are executed, while this function stops the execution of the next instructions.