2017-09-27 05:29 AM
Hi,
I
use the
STM32L152RE
device
and
I
found some problems when I
execute
the sleep mode
in STM32CubeHALv1.7.0
.
In fact, w
hen I use the __HAL_PWR_VOLTAGESCALING_CONFIG function with PWR_REGULATOR_VOLTAGE_SCALE3 for
a
low frequenc
y (lower than 4MHz)
, this instruction
stops the
execut
ion
, while this function is executed for the two other
ranges
(PWR_REGULATOR_VOLTAGE_SCALE1 and PWR_REGULATOR_VOLTAGE_SCALE2). I tried to change the value of this variable
(PWR_REGULATOR_VOLTAGE_SCALE3)
from
PWR_CR_VOS (
0x00001800
)
to 0x0000C000. With this setting, the function runs.
P
lease, is it possible to check if there is an error
in the
definition
of this value?
In the other hand
, the HAL_RCC_DeInit
function
does not execut
e
. Indeed,
the
execution
is stopped
in
the function of switching the SYSCLK to MSI
(CLEAR_BIT(RCC->CFGR, RCC_CFGR_SW);)
. When, I
change this function CLEAR_BIT
by
SET_BIT
function
and change the order of the 4
th
instruction (Reset CFGR register) before
the instruction switch SYSCLK to MSI, the code is executed and the sleep mode
outperforms
the normal mode
in terms of energy consumption
.
P
lease, can you verify if there
are
some problem
s
in the function
HAL_RCC_DeInit
?
T
hank you in advance.
Best regards,
Wassim Ben Chikha
Note: this post was migrated and contained many threaded conversations, some content may be missing.2017-10-04 11:14 AM
2017-10-04 01:40 PM
Hello !
I ran your code and i didn't faced any problem. I use
STM32CubeHALv1.8.0
and here are the results:
the code executed with 2 Mhz input.
Where exactly at your program occur this hang?
regards
vf
2017-10-05 02:51 AM
Hello,
As seen in the following
print screen
, I have added two printf (one before setting range 3 and one after setting range 3). This is to verify if__HAL_PWR_VOLTAGESCALING_CONFIG function with PWR_REGULATOR_VOLTAGE_SCALE3 is executed.
When, I run the main program and choosing sleep mode as low power mode, you can see in the following
print screen
that only the message before __HAL_PWR_VOLTAGESCALING_CONFIG function is shown which prove that this function stops the execution.Best regards,
Wassim Ben Chikha
2017-10-05 11:15 AM
This is an aside, but the followingpost calls the utility of polling for the VOSF flag into question:
2017-10-05 12:29 PM
Hi Andrew
I noticed that when ran the code with Keil. (previous post).
I found also inside HAL stm32l1xx_hal_pwr.h this
I think tis explanation is logic enough.
2017-10-05 12:42 PM
Hi Vangelis. I have seen both pieces of documentation but the problem is that they have conflicting meaning.
The reference manual says the processor does this for us, by pausing execution when unstable and resuming execution after it becomes stable, which is how ST's libraries seem to be handling it (by omitting the VOSF poll).
Yes, it's easy to put in whatis basically NOP to cover both cases, but I much prefer a having a clear understanding of the system operation.
2017-10-18 07:16 AM
Hello Imen,
Please, I would like to know if my reported issue about
HAL_RCC_DeInit
function
is confirmed internally?
Many thanks for your time and looking forward for your response.
KR,
WBC
2017-11-21 10:29 AM
2017-11-22 03:40 AM
Hello,
Thank you Luca, this issue is already raised internally to the developer team for fix.
Best Regards
Imen