2023-04-25 09:30 AM
I could not find any information relates to vbat battery charging in user manual or datasheet.
Is this feature supported in STM32MP15x?
Thanks,
Solved! Go to Solution.
2023-04-26 01:53 AM
Hi Dat Tran (Community Member)
In OSTL (DV4.1) The optee driver enables it.
arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr.c
..
if (fdt_getprop(fdt, node, "st,enable-vbat-charge", NULL)) {
uintptr_t cr3 = stm32_pwr_base() + PWR_CR3_OFF;
io_setbits32(cr3, PWR_CR3_VBE);
if (fdt_getprop(fdt, node, "st,vbat-charge-1K5", NULL))
io_setbits32(cr3, PWR_CR3_VBRS);
}
Configurable in the DT
Add VBAT charge static configuration from the pwr regulator
device-tree node.
- st,enable-vbat-charge is used to enable charge
- st,vbat-charge-1K5 is used to enable fast charge with 1500 Ohms.
You may try to set it at optee board level in the "&pwr_regulators" node
Regards,
Olivier
2023-04-25 10:49 AM - edited 2023-11-20 07:09 AM
JW
2023-04-25 11:17 AM
Yes, thank you so much. Not sure why I didn't see it before.
2023-04-25 11:22 AM
By the way, do we have any built-in driver that enable charging?
example we have rtcwake to set alarm
do we have something line rtccharge .... to enable charging?
Thanks
2023-04-26 01:53 AM
Hi Dat Tran (Community Member)
In OSTL (DV4.1) The optee driver enables it.
arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr.c
..
if (fdt_getprop(fdt, node, "st,enable-vbat-charge", NULL)) {
uintptr_t cr3 = stm32_pwr_base() + PWR_CR3_OFF;
io_setbits32(cr3, PWR_CR3_VBE);
if (fdt_getprop(fdt, node, "st,vbat-charge-1K5", NULL))
io_setbits32(cr3, PWR_CR3_VBRS);
}
Configurable in the DT
Add VBAT charge static configuration from the pwr regulator
device-tree node.
- st,enable-vbat-charge is used to enable charge
- st,vbat-charge-1K5 is used to enable fast charge with 1500 Ohms.
You may try to set it at optee board level in the "&pwr_regulators" node
Regards,
Olivier
2023-04-26 02:20 AM
Notice that this 'charge' is intended for an external SuperCap on VBAT (to avoid need for an external diode+resistor), must not be used with Lithium Coin-cell or any kind of rechargeable battery.
As written in product reference manual, the 'charge' resistor is automatically disconnected in absence of VDD.
Regards.
2023-04-26 06:41 AM
Thank you. Yes we are using SupperCap.
Following code above, only enable charge, do we need to stop charging? what if the cap is full?
2023-04-26 07:27 AM
Hi,
no need to disable as capacitor charge current will null when its voltage is equal to VDD.
No risk of 'overcharge' a capacitor (it's not a battery).
Just need to enable charge resistor on each cold boot (as PWR_CR3 register is not saved in VBAT), but this is already the case if selected in DeviceTree as listed above.
Regards.
2023-04-26 08:24 AM
yes, thank you a lot for this information.