cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 - How to use RTC under backup battery.

FGava.1
Associate II

I work around a project based on STM32WB55.

In this project it is necessary to keep a clock / calendar when the card is off.

We usually use external real time clock / calendar such as PCF85063A.

I work with the core board and try to use the WB55 RTC, with the VBat pin connected to an supercap cell,

The VBat is enabled with 1.5K resistor and load correctly the supercap.

If i do an software reset is all ok.

When take out the power and restart it, the VBAT pin stay to 3V for long time, but my RTC will go back to 0 to all register calendar and time.

You can help me?

Thank you

6 REPLIES 6
MM..1
Chief II

Part of AN5071

To retain both the content of the Backup registers and supply the RTC function when VDD is turned off, the VBAT pin must be connected to an optional backup voltage supplied by a battery or by another source: VBAT must be between 1.55 to 3.6 V VBAT is the power supply for the RTC, the external clock 32 kHz LSE oscillator and the backup registers (through power switch) when VDD is not present. When VDD is present these peripherals (RTC, LSE) are automatically supplied by VDD, and it is then possible to charge the external battery on VBAT through an internal resistance. 

Isn't it your code (including any Cube stuff you're calling) which resets the RTC?

Check RTC registers' content in debugger at the start of main(), before calling any Cube function.

JW

it is exactly what I expect!

Thanks for the info. Now I read the document and try again ...

Unfortunately no!

I need the updated date and clock time after an (long) period without power supply.

Normally we use an external RTC chip with button-cell battery, connected via I2C.

In this case we have to save on costs and space.

I try to check register at the first step in main().

Tankyou for your help

Simply your LSE must continue working from battery, and in code you need activate backup registers (through power switch)

Examples \Users\YUO\STM32Cube\Repository\STM32Cube_FW_WB_V1.12.1\Projects\P-NUCLEO-WB55.Nucleo\

Sorry ... I have considered known that the WB55 I use it with an radio stack, BLE in this case, derived from demo BLE_p2pServer

Now: i MUST set #define CFG_HW_RESET_BY_FW 0, otherwise the BLE management resets the backup registers at startup.

See also static void Reset_Device (void)

Thanks for your support. Bye.