Skip to main content
Dat Tran
Senior II
Apr 25, 2023 4:30 PM UTC
Solved

Does STM32MP15x support VBAT battery charging?

I could not find any information relates to vbat battery charging in user manual or datasheet.

​

Is this feature supported in STM32MP15x?

Thanks,

​

​

​

This topic has been closed for replies.
OlivierK
OlivierKBest answer
ST Technical Moderator
Apr 26, 2023 8:53 AM UTC

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

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

8 replies

waclawek.jan
Super User
Apr 25, 2023 5:49 PM UTC


_legacyfs_online_stmicro_images_0693W00000bio0bQAA.pngJW

Dat Tran
Dat TranAuthor
Senior II
Apr 25, 2023 6:17 PM UTC

Yes, thank you so much. Not sure why I didn't see it before.

Dat Tran
Dat TranAuthor
Senior II
Apr 25, 2023 6:22 PM UTC

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

​

OlivierK
OlivierKBest answer
ST Technical Moderator
Apr 26, 2023 8:53 AM UTC

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

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
PatrickF
ST Employee
Apr 26, 2023 9:20 AM UTC

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.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
Dat Tran
Dat TranAuthor
Senior II
Apr 26, 2023 1:41 PM UTC

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?

PatrickF
ST Employee
Apr 26, 2023 2:27 PM UTC

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.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
Dat Tran
Dat TranAuthor
Senior II
Apr 26, 2023 3:24 PM UTC

yes, thank you a lot for this information.