cancel
Showing results for 
Search instead for 
Did you mean: 

Does STM32MP15x support VBAT battery charging?

Dat Tran
Senior II

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

Is this feature supported in STM32MP15x?

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
OlivierK
ST Employee

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

View solution in original post

8 REPLIES 8


_legacyfs_online_stmicro_images_0693W00000bio0bQAA.pngJW

Dat Tran
Senior II

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

Dat Tran
Senior II

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
ST Employee

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

PatrickF
ST Employee

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.
Dat Tran
Senior II

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?

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.
Dat Tran
Senior II

yes, thank you a lot for this information.