cancel
Showing results for 
Search instead for 
Did you mean: 

How to change VOS bits in 32L0xx

Zoran Daric
Associate II
Posted on January 25, 2017 at 08:19

Hi,

According to reference manual RM0377 (page 138 6.1.5 Dynamic voltage scaling configuration)  programming voltage regulator is very easy. Unfortunately I'm not able to do this on two Nucleo demo boards with STM32L031 and STM32L053 MCUs. After writing a new value to VOS bits in PWR_CR register, I read always the same value 1.5V (range 2). Is there any other condition, except power supply, that has influence on this? Please help me to solw this problem.

Regards

#stm32l0-voltage-scaling
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on January 31, 2017 at 21:53

To be able to write to PWR registers, you have first to enable PWR's clock by setting RCC_APB1ENR.PWREN.

With the ADC problem, please start a new thread.

JW

View solution in original post

11 REPLIES 11
Nesrine M_O
Lead II
Posted on January 26, 2017 at 10:23

Hi,

An embedded linear voltage regulator supplies all the digital circuitries except for the Standby circuitry. The regulator output voltage (VCORE) can be programmed by software to three different ranges:

  • Range 1 (VDD range limited to 1.71-3.6 V), with the CPU running at up to 32 MHz

  • Range 2 (full VDD range), with a maximum CPU frequency of 16 MHz

  • Range 3 (full VDD range), with a maximum CPU frequency limited to 4.2 MHz

0690X0000060693QAA.png

To have more idea about system power configuration, I recommend you to start with PWR examples under the STM32L0 firmware package:

STM32Cube_FW_L0_V1.8.0\Projects\STM32L031K6-Nucleo\Examples\PWR

-Nesrine-

Posted on January 26, 2017 at 11:23

 ,

 ,

Hi

Unfortunately this does not help me. I have system that does not go

to Standby mode, supply is 3,3V and frequency is 525kHz or 4,2MHz.

According to documentation this should work but...

STM32L031 we intend to use in new project for Smart-Home system.

Plan is to produce minimum 10,000 devices in first year. Do you have

somebody who knows this problem and is able to help me?

I was not able to find recommended packet.

Regards

Zoran

W dniu 2017-01-26 o 10:25, Nesrine M pisze:

>,

STMicroelectronics Community

<,https://community.st.com/?et=watches.email.thread>,

>,

Re: How to change VOS bits in 32L0xx

reply from Nesrine M

<,

in /STM32 MCUs Forum/ - View the full discussion

<,https://community.st.com/message/144568-re-how-to-change-vos-bits-in-32l0xx?commentID=144568&,et=watches.email.thread ♯ comment-144568>,

>,

Posted on January 26, 2017 at 11:53

Hi,

  • Have you try this example: STM32Cube_FW_L0_V1.8.0\Projects\STM32L031K6-Nucleo\Examples\PWR\PWR_STANDBY with no success?
  • Could you please precise if you are using a custom board or an ST board?
  • Could you please provide more explanation on your case, so that it will be easier to understand the issue?

-Nesrine-

Posted on January 26, 2017 at 14:06

Hi,

Thank you for prompt answer.

I didn't try recommended example because I was not able to find it,

as I wrote in my previous email. If example is written in C, I will not

be able to understand. I use only assembler, in this case it is uVision5

(Keil).

At this moment I'm using two Nucleo ST demo boards (this is written

in my first mail) but very soon I'll do custom board.

For this device I wrote custom boot loader with 1k Xmodem protocol

and two separate terminals (for LpUart1 and Usart2). First is used for

communication with Wi-Fi module and second for debugger and application

update. From both terminals it is possible to change booting parameters

like minimum and maximum system clock, watch god timer, Uarts

parameters, real time clock, systick timer ... All this is working very

good but the only problem I have is power management (changing two VOS

bits in PWR_CR register.

In reference manual RM0367 on page 146 in 6.1.6 Dynamic voltage

scaling configuration is written:

The following sequence is required to program the

voltage regulator ranges:

1. Check VDD to identify which ranges are allowed (see

Figure 11: Performance versus VDD and VCORE range).

2. Poll VOSF bit of in PWR_CSR. Wait until it is reset

to 0.

3. Configure the voltage scaling range by setting the

VOS[1:0] bits in the PWR_CR register.

4. Poll VOSF bit of in PWR_CSR register. Wait until it

is reset to 0.

This doesn't work. Whatever I put on these 2 bits I always read

that is 1,5V. I tried to find if there are additional registers that I

have to set or reset like if you want to set system clock on 32MHz you

have to set certain voltage range, but I didn't find anything. I guess

that is a trivial solution but I need somebody who knows this problem.

Regards

Zoran

W dniu 2017-01-26 o 11:54, Nesrine M pisze:

>

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

>

Re: How to change VOS bits in 32L0xx

reply from Nesrine M

<https://community.st.com/people/ELMHIRI.Syrine?et=watches.email.thread>

in /STM32 MCUs Forum/ - View the full discussion

<https://community.st.com/message/144578-re-how-to-change-vos-bits-in-32l0xx?commentID=144578&et=watches.email.thread&sharpcomment-144578>

>

Posted on January 30, 2017 at 09:59

Hi

Daric.Zoran

,

Could you please share with us your assembly code for check.

-Nesrine-

Posted on January 30, 2017 at 17:59

Hi,

In attachment you can find Test project written in Keil. It is very

short program written according to instruction in Reference Manual

RM0367 page 146 ( 6.1.6 Dynamic voltage scaling configuration). Program

is trying to change voltage range from 2 to 3 but after ridding PWR_CR

register, voltage range is 2 (default value).

Regards

Zoran

W dniu 2017-01-30 o 10:00, Nesrine M pisze:

>

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

>

Re: How to change VOS bits in 32L0xx

reply from Nesrine M

<https://community.st.com/people/ELMHIRI.Syrine?et=watches.email.thread>

in /STM32 MCUs Forum/ - View the full discussion

<https://community.st.com/message/144886-re-how-to-change-vos-bits-in-32l0xx?commentID=144886&et=watches.email.thread#comment-144886>

>

________________

Attachments :

Test.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyxi&d=%2Fa%2F0X0000000bEa%2Ff0TDZu3E7asPcERAvBRyBhZpNAZF4k7V1NVIav7wg.w&asPdf=false
Posted on January 31, 2017 at 21:29

Hi

In a mean time while I'm waiting for the answer regarding voltage

range, I faced with very strange behavior of the ADC.

Generally I need only one A/D conversion at a time. There are few

channels that I have to check from time to time. During tests of the A/D

converter I read Vrefint (channel 17). If very shortly after

calibration, about 1 second, I do the A/D conversion, everything is OK,

I have correct value. In case I wait for a few seconds (more then 4

seconds) result is wrong. If I do second read very shortly, less then 4

second, I got correct result. If I do reading every second, the results

are OK except first one. Note that incorrect value always is 2048

decimal (very strange).

In case I do reading two different channels effect is the same.

This mean that I always have to do two conversions to have correct value

or to do readings non-stop for all the necessary channels even if I

don't need it.

In the attachment you can find my flowcharts for ADC calibration,

setup and conversion. Please check and tell me what I do wrong.

Note that clock source for the ADC is HSI at 4MHz. All other

parameters except parameters changed in setup after calibration are

default values after reset. Changing sampling time doesn't help.

Regards,

Zoran

P.S.

I put two of my colleagues in the copy of this email. Reason, they

have to know about problems I have with our project.

W dniu 2017-01-30 o 10:00, Nesrine M pisze:

>

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

>

Re: How to change VOS bits in 32L0xx

reply from Nesrine M

<https://community.st.com/people/ELMHIRI.Syrine?et=watches.email.thread>

in /STM32 MCUs Forum/ - View the full discussion

<https://community.st.com/message/144886-re-how-to-change-vos-bits-in-32l0xx?commentID=144886&et=watches.email.thread&sharpcomment-144886>

>

Posted on January 31, 2017 at 21:32

Sorry I forgot attachment

Zoran

W dniu 2017-01-30 o 10:00, Nesrine M pisze:

>

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

>

Re: How to change VOS bits in 32L0xx

reply from Nesrine M

<

in /STM32 MCUs Forum/ - View the full discussion

<https://community.st.com/0D70X000006T0JXSA0

>

________________

Attachments :

ADC.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyxr&d=%2Fa%2F0X0000000bEV%2Fla0cIRKnlfgxONB_bpMDrJtD17SN5cmGaabIK40ODcg&asPdf=false
Posted on January 31, 2017 at 21:53

To be able to write to PWR registers, you have first to enable PWR's clock by setting RCC_APB1ENR.PWREN.

With the ADC problem, please start a new thread.

JW