cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Programmable Voltage Detect?

bruce
Associate II
Posted on January 30, 2009 at 19:21

How to use Programmable Voltage Detect?

2 REPLIES 2
bruce
Associate II
Posted on May 17, 2011 at 13:01

I also haven't been able to get it to work. It looks easy, the functions in the function library seem straightforward, but it doesn't work.

As the function library suggests, I use the following 2 commands to enable it. Both are supposed to write into the PWR_CR register.

PWR_PVDCmd(ENABLE);

PWR_PVDLevelConfig(PWR_PVDLevel_2V8);

If I read the register (0x70004000) after these commands, it still shows 0.

It's as if the register is somehow write protected.

And of course the PVDO bit in the PWR_CSR register never flips, no matter how the register is set. 0x70004000

If anyone has gotten this feature to work, please let us know.

Thanks

bruce
Associate II
Posted on May 17, 2011 at 13:01

Figured it out. The following code enables it (I hadn't enabled the PWR peripheral).

RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR , ENABLE);

PWR_PVDCmd(ENABLE);

PWR_PVDLevelConfig(PWR_PVDLevel_2V8);

And you can read the status with this:

PWR_GetFlagStatus(PWR_FLAG_PVDO);

After a cursory check, seems to work well.