Skip to main content
Terje Bøhler
Associate III
January 9, 2019
Question

My PVD (Programmable Voltage Detector) don’t work

  • January 9, 2019
  • 2 replies
  • 1562 views

0690X000006D12FQAS.pngHi.

I want my MCU (STM32F107VCT6) to generate an interrupt when the Vdd is below (e.g.) 2.9V. I have implemented the following init-code:

PWR->CR = PWR_CR_PLS_2V9; // 2.9V
mcu_reg = PWR->CR;
PWR->CR |= PWR_CR_PVDE; // Bit 4 PVDE: Power voltage detector enable.
mcu_reg = PWR->CR; 
 
// For test purposes only ...
// Bit 2 PVDO: PVD output
// This bit is set and cleared by hardware. It is valid only if PVD is enabled by the PVDE bit.
// 0: VDD/VDDA is higher than the PVD threshold selected with the PLS[2:0] bits.
// 1: VDD/VDDA is lower than the PVD threshold selected with the PLS[2:0] bits.
mcu_reg = PWR->CSR; 
 
NVIC_EnableIRQ(PVD_IRQn); // Uses EXTI line 16

Q1: When I run (Keil uV5 and ULINK2) the above init-code, I always read back 0 from both the registers above (as if the contents written is not actually written into the register). Why?

Q2: When I run my application the PVDO-bit is never set, even when the Vdd is below 2.5V. Why?

Q3: It seems like the “PVDO�? bit is not enebled (it is “shaded�? (see below)). Why?

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
January 9, 2019

Is PWR/BKP enabled and UNLOCKED?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Terje Bøhler
Associate III
January 11, 2019

Thanks Clive.

Which registers are you referring to?

My "RM0008 Reference manual" is not very specific, and I do not have an example project for this PVD-feature. I would very much appreciate if you could be more specific.

Q1: Is it a RCC->APB1ENR |= RCC_APB1ENR_PWREN you are referring to (that's missing)?

Q2: Which register performs the "UNLOCK"?

Q3: The BKP is "Backup Register"???

I very much appreciate som further clarifications to this matter.

BR Terje