Skip to main content
Associate II
July 8, 2025
Solved

Technical guidance for STM32G070RB

  • July 8, 2025
  • 3 replies
  • 495 views

Dear STM communality member,

Greeting of the day!

I have selected STM32G070RB MCU for my application, I need your guidance to get clarification on the the below points before finalizing the MCU and start hardware design.

Error in the calendar after one year with internal 32KHz crystal selected for RTC.
Can Li-ion battery connected to VBAT pin will provide power to MCU, when input power failure, to save the parameter to flash.
I have selected TIM1 for encoder and TIM14 for PWM output, can I use encoder and PWM functionality in debug mode. refer below image from data sheet.
Data sheet link: https://www.st.com/en/microcontrollers-microprocessors/stm32g070rb.html

patliputram_3-1751965644030.png

 

patliputram_4-1751965657074.png

Thanks in advance..

Regards,

Anand Sagar

 

 

Best answer by waclawek.jan

> Error in the calendar after one year with internal 32KHz crystal selected for RTC.

That depends on the exact type of crystal and the circuitry around it (including the PCB layout). Read AN2867 thoroughly.

One year is cca 30 million seconds, so one ppm of error is cca 30 seconds per year. With careful layout and well chosen crystal it is quite feasible to achieve cca 10-20ppm error, so that's cca 10 minutes. Applying fine calibration as per description in the RM, cca 1-2 ppm is feasible, that's around 1 minute.


> Can Li-ion battery connected to VBAT pin will provide power to MCU, when input power failure, to save the parameter to flash.

No. VBAT powers only the backup domain, which in 'G0 is only the RTC with backup registers, see VBAT operation chapter in datasheet.

> I have selected TIM1 for encoder and TIM14 for PWM output, can I use encoder and PWM functionality in debug mode. refer below image from data sheet.

The debugger you are using should have some setting to enable/disable the timer freeze during debugging break/single-stepping.  This feature is enabled/disabled through DBG_APB_FZx registers, see DBG chapter in Reference Manual.

JW

3 replies

TDK
Super User
July 8, 2025

> Error in the calendar after one year with internal 32KHz crystal selected for RTC.

It doesn't have an internal crystal. It has an LSI, which is not particularly accurate. See the datasheet for accuracy specification. It will be more than a day wrong after a year.
> Can Li-ion battery connected to VBAT pin will provide power to MCU, when input power failure, to save the parameter to flash.

When power fails and VBAT becomes active, it is already too late to save something to flash. You need to do it before power fails.
> I have selected TIM1 for encoder and TIM14 for PWM output, can I use encoder and PWM functionality in debug mode. refer below image from data sheet.

You can use TIM1 for encoder and TIM14 for PWM while debugging, yes. They are independent. Freezing the counter during debugging is optional. Up to you.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate II
July 10, 2025

Thanks for the clarification.

waclawek.jan
waclawek.janBest answer
Super User
July 8, 2025

> Error in the calendar after one year with internal 32KHz crystal selected for RTC.

That depends on the exact type of crystal and the circuitry around it (including the PCB layout). Read AN2867 thoroughly.

One year is cca 30 million seconds, so one ppm of error is cca 30 seconds per year. With careful layout and well chosen crystal it is quite feasible to achieve cca 10-20ppm error, so that's cca 10 minutes. Applying fine calibration as per description in the RM, cca 1-2 ppm is feasible, that's around 1 minute.


> Can Li-ion battery connected to VBAT pin will provide power to MCU, when input power failure, to save the parameter to flash.

No. VBAT powers only the backup domain, which in 'G0 is only the RTC with backup registers, see VBAT operation chapter in datasheet.

> I have selected TIM1 for encoder and TIM14 for PWM output, can I use encoder and PWM functionality in debug mode. refer below image from data sheet.

The debugger you are using should have some setting to enable/disable the timer freeze during debugging break/single-stepping.  This feature is enabled/disabled through DBG_APB_FZx registers, see DBG chapter in Reference Manual.

JW

Associate II
July 10, 2025

Hello Jan Waclawek,

Thanks for the clarification.

 

Regards,

Anand Sagar

July 10, 2025

Yes, internal 32KHz can drift a bit external crystal is better for accuracy.
VBAT works fine with Li-ion to keep RTC running during power loss.
TIM1 for encoder and TIM14 for PWM should work during debug just check settings.
Hope this clears things up! Let me know if you get stuck.

Associate II
July 10, 2025

Thanks Mike..