2025-07-08 2:08 AM
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
Thanks in advance..
Regards,
Anand Sagar
2025-07-08 7:31 AM - edited 2025-07-08 7:31 AM
> 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.
2025-07-08 7:39 AM
> 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