2018-04-16 02:52 AM
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-charging2018-04-16 04:37 AM
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
2018-04-16 05:03 AM
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.
2018-04-16 06:42 AM
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 chargerBTW, does anyone know what is the Mbed constant name for my RCC_APB1ENR_PWREN ?
2018-04-16 07:27 AM
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?
JW2018-04-16 08:28 AM
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 ?)
2018-04-16 09:07 AM
RCC_APB1ENR1_PWREN
2018-04-16 09:13 AM
Oh ok, I was close enough, just misread it and forgot '1' Thanks again.