Skip to main content
Dat Tran
Senior II
April 25, 2023
Solved

Does STM32MP15x support VBAT battery charging?

  • April 25, 2023
  • 7 replies
  • 1978 views

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.
Best answer by OlivierK

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

7 replies

waclawek.jan
Super User
April 25, 2023


_legacyfs_online_stmicro_images_0693W00000bio0bQAA.pngJW

Dat Tran
Dat TranAuthor
Senior II
April 25, 2023

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

Dat Tran
Dat TranAuthor
Senior II
April 25, 2023

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
Technical Moderator
April 26, 2023

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
Technical Moderator
April 26, 2023

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 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
Dat Tran
Dat TranAuthor
Senior II
April 26, 2023

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
Technical Moderator
April 26, 2023

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 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
Dat Tran
Dat TranAuthor
Senior II
April 26, 2023

yes, thank you a lot for this information.