2024-02-06 08:39 PM - edited 2024-02-06 08:40 PM
Hello Community,
We are selecting a high stability 12.288MHz HSE to clock our RTC on STM32G0 series MCUs.
Kindly suggest if the HSE/32 which is 384kHz would be able to operate the RTC? I did not find any mentions of the maximum clock frequency for the RTC on STM32 MCUs. I understand the RTC has a prescaler, kindly direct me to the correct configurations.
Thank you!
Solved! Go to Solution.
2024-02-07 12:44 AM
The key document for this is the Reference Manual for your stm32.
Looking at the Reference Manual RM0444 for STM32G0x1, in section 30 "Real Time Clock" I can see that your 384 kHz would go through an asynchronous prescaler (default value 128) followed by a synchronous prescaler (default value 256), the product of those two being used to generate a 1 Hz clock from the default 32768 Hz.
So the question is can you reconfigure those prescalers to get 1 Hz from 384 kHz?
RTC_PRER has 7 bits of PREDIV_A (so max value 127) and 15 bits of PREDIV_S (so max value 32767)
And you are after 1 Hz when dividing 384000 by (PREDIV_A+1)*(PREDIV_S+1)
For lowest power, you want PREDIV_A as high as possible, so let's put it at 127.
So PREDIV_S would need to be (384000/(127+1)) - 1, which I make as 2999
This easily fits into 15 bits. So yes it can be done.
2024-02-07 12:44 AM
The key document for this is the Reference Manual for your stm32.
Looking at the Reference Manual RM0444 for STM32G0x1, in section 30 "Real Time Clock" I can see that your 384 kHz would go through an asynchronous prescaler (default value 128) followed by a synchronous prescaler (default value 256), the product of those two being used to generate a 1 Hz clock from the default 32768 Hz.
So the question is can you reconfigure those prescalers to get 1 Hz from 384 kHz?
RTC_PRER has 7 bits of PREDIV_A (so max value 127) and 15 bits of PREDIV_S (so max value 32767)
And you are after 1 Hz when dividing 384000 by (PREDIV_A+1)*(PREDIV_S+1)
For lowest power, you want PREDIV_A as high as possible, so let's put it at 127.
So PREDIV_S would need to be (384000/(127+1)) - 1, which I make as 2999
This easily fits into 15 bits. So yes it can be done.
2024-02-11 07:05 AM
Thank you @Danish1,
This was a clear & precisely written solution for the query.