cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in sleep mode using STM32CubeHALv1.7.0

Wassim Ben Chikha
Associate II
Posted on September 27, 2017 at 14:29

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.
18 REPLIES 18
Posted on October 04, 2017 at 18:14

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6tW&d=%2Fa%2F0X0000000bxW%2F2iPy90F42GvVvYo7Ng2GFV_oyzlW1UOtxxnV14ukpYk&asPdf=false
Posted on October 04, 2017 at 20:40

Hello !

I ran your code and i didn't faced any problem. I use 

STM32CubeHALv1.8.0

0690X00000608U9QAI.png

and here are the results:

0690X00000608UIQAY.png

the code executed with 2 Mhz input.

Where exactly at your program occur this hang?

regards

vf

Posted on October 05, 2017 at 09:51

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.

0690X00000608RjQAI.png

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.

0690X00000608RkQAI.png

Best regards,

Wassim Ben Chikha

Posted on October 05, 2017 at 18:15

This is an aside, but the followingpost calls the utility of polling for the VOSF flag into question:

https://community.st.com/0D50X00009Xkf1GSAR

Posted on October 05, 2017 at 19:29

Hi Andrew

I noticed that when ran the  code with Keil. (previous post).

I found also inside HAL  stm32l1xx_hal_pwr.h this

0690X00000608P4QAI.png

I think tis explanation is logic enough.

Posted on October 05, 2017 at 19:42

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.

Posted on October 18, 2017 at 14:16

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

176098CGIL2
Imen.D
ST Employee
Posted on November 22, 2017 at 12:40

Hello,

Thank you Luca, this issue is already raised internally to the developer team for fix.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen