2023-07-23 11:41 PM
I'm currantly working on STM32G4 series and I had a problem. I initiate PC13 pin as GPIO_INPUT to read state from button. But It is possible to config this pin(PC13) such as RTC_OUT1. I config my RTC clock on Activate Clock Source to write and read actually time. When I write time to RTC I receive a clock source (1Hz) on pin PC13 and it is impossible to change it. I must turn off the device and wait a few seconds after that. I'm looked for what happend and I found that ST library(rtc library) modify registers on that way.
I'm never modify registers, so I'm confused that is it mistake on library or I do something wrong?
* I'm config RTC from LSE (32.768kHz) frequency.
2023-07-23 11:57 PM - edited 2023-07-23 11:59 PM
Do you use Cube/HAL? Do you fully initialise the initialization structs before calling the clock setup functions?
How is VBAT connected? Maybe this is consequence of VBAT brownout?
2023-07-24 12:46 AM
I use Cube/HAL. This is my RTC initialization.
There is nothing complicated. On HAL_RTC_INIT we go to library on ST.
It is True that VBAT is connected in specific way but the voltage on VBAT is the range on 2,5 to 3,3V, but when I checked VBAT pins, thanks to osciloscope The Voltage is stable 3V.
2023-07-24 12:48 AM
BTW. Thank you for this link 🙂
2023-07-24 12:55 AM
I currently commented this modifying registers and cuurently everythink working fine. But I'm not sure that changing library is a correct way, so I want to understand what happend there 🙂
2023-07-24 02:37 AM
Cube is open source, so you can debug it as any other code, to find out why does it write incorrect/unexpected values to RTC registers.
You can also place data breakpoint (a.k.a. watchpoint) to given register to find out where and what value is written to it.
JW
2023-07-27 07:11 AM
Hello @Mongolov ,
To enable the calibration output (" (1Hz) on pin PC13"), the RTC_CR_COE bit need to be enable.
In order to use the PC13 pin as standard GPIO you need to respect the condition given by the table 333. inside RM0440:
Maybe one of this condition is not ok.
Best Regards,
Ced
2023-07-27 07:18 AM
Hi @Ced ,
> To enable the calibration output (" (1Hz) on pin PC13"), the RTC_CR_COE bit need to be enable.
Mongolov does *not* want to use PC13 as calibration output:
> I initiate PC13 pin as GPIO_INPUT to read state from button.
JW
2023-07-27 07:47 AM
Hello @waclawek.jan ,
Yes, I understand the point.
Mongolov saw '(1Hz) on pin PC13. So, I guess that is the RTC calibration output is enabled on RTC Output 1.
And to use the PC13 as the standard GPIO Pin (GPIO_INPUT) he need to follow condition given by the table 333.
Best Regards,
Ced