cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 L4 VBAT internal battery charging

Christophe MARIN
Associate II
Posted on April 16, 2018 at 11:52

I'm currently struggling with my Nucleo STM32L476RG board about VBAT battery charging feature.

- I removed the SB45 on baord bridge to unbound the VBAT pin from the power supply

- I wired a 100uF/4V tantalum capacitors, which offers more than 5mn of backup for the RTC (yes, that's enough for my application).

I'm now trying to use the VBAT internal battery charging feature by setting the appropriates bits:

    SET_BIT(PWR->CR4, PWR_CR4_VBRS);

    SET_BIT(PWR->CR4, PWR_CR4_VBE);

But this seems to have no effect: as soon as I remove the link from my backup capacitor to the power supply, the voltage slowly drops down, as if there were no internal battery charging feauture enabled. (Yes, forgot to mention, there is a Schottky diode from capacitor to the Vdd, and I cut the link from the cap and the diode).

Any idea about what I'm currently missing ?

#vbat #stm32-l4 #battery-charging
7 REPLIES 7
Posted on April 16, 2018 at 13:37

Tantalum capacitors have high leaking current.

DC leakage current of tantalum capacitors vary within a range of 0.01 - 0.1CV or 0.5μA (whichever is the greater).

As CV=It, you can count only on a hundred of seconds or less.

JW

Christophe MARIN
Associate II
Posted on April 16, 2018 at 14:03

I know about leakage current for tantalum capacitors, and as mentionned above, the resulting time constant is ok for my application. My question was about the internal Vbat charging feature that doesn't seem to be effective, so far, whatever I'm trying.

Christophe MARIN
Associate II
Posted on April 16, 2018 at 15:42

Thanks to someone's answer, the correct settings are:

  

  #define RCC_APB1ENR_PWREN (1 << 28)   // What is the declaration for that in the Mbed library ? Did not find it...

    SET_BIT(RCC->APB1ENR1, RCC_APB1ENR_PWREN);   // This one was missing...

    SET_BIT(PWR->CR4, PWR_CR4_VBRS);                          // Sets the charging resistor to low value (1k5)

    SET_BIT(PWR->CR4, PWR_CR4_VBE);                             // Enables the internal VBAT charger

BTW, does anyone know what is the Mbed constant name for my RCC_APB1ENR_PWREN  ?

Posted on April 16, 2018 at 14:27

Ah, I didn't read your post to the end... sorry... :blushing:

Have no experience with that one. Try perhaps to read back the PWR_CR4 register and check if those bits are set as expected.

Is the clock to PWR switched on in RCC?

JW
Posted on April 16, 2018 at 15:28

Bingo! I did not even know that the PWR of the clock was to be set in the RCC, that's it. Now it works fine. Thanks a lot.

(... don't you find the given datasheet a lil' confusing about that missing info ?)

Posted on April 16, 2018 at 16:07

RCC_APB1ENR1_PWREN

Posted on April 16, 2018 at 16:13

Oh ok, I was close enough, just misread it and forgot '1' Thanks again.