2021-09-01 07:31 AM
HI,good mornig,
I'm starting to use RTC on STM32G0...family
I'm using NUCLEO board G071RB for initial tests and I setted it as follow:
1) introducing 2032 battery on Vbat pin (previous disconnect SB26 jumper (Vdd))
2) select LSE by STCubeMX configuration tool
By using uart2 trought ST-Link (on nucleo), the FW sends each 5sec date and time to PC.
RTC is working well when Vdd is present ( Nucleo board is supplied by USB ).
I also checked by scope either 3.3V on Vbat pin and oscillation from 32.768KHz quarz on board (signal quite low but seems enough to trigger ready flag in RCC reg.).
So, I try to disconnect Vdd from MCU, by disconnecting JP3; in this situation I check also 3.3V from battery and clock from quarz but when I re-supply MCU by inserting JP3, the RTC is stopped (seem from a reset event).
Can you help and suggest where I'm wrong?
Thank you
N.B. I tried on another board G071RB, and the 32.678 Khz clock doesn't work when LSE is selected!!!
2021-09-01 08:20 AM
Welcome, @FSpre.1, to the community!
Oscilloscope probes usually have an input resistance that is too small and put too much stress on the extremely sensitive LSE, so that a measurement is rarely possible without knowing the exact parameters of the probe (input capacitance, input resistance).
The MCU goes through the reset if you reconnect JP3 and it depends on the inititialization, what happens with the RTC. CubeMX, for example, generates a skeleton program that sets the date and time so that you have a defined behavior when debugging. However, there are ways to hide this basic setting in the generated code using a pragma so that a new generation of programs with CubeMX does not overwrite it.
Regards
/Peter
2021-09-01 08:40 AM
Thank you Peter!, of course you are rigth about impedence of probe.
Yes I had already ruled out(by "//" comment ist.) the MX_RTC_init() function in order to not re-initialize RTC at each power on
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
// MX_RTC_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
By emulator I program RTC the first/one time during while(1), after checking that RTC is working well either by watch window of emulator and by frame sent on serial port, I turn off Vdd (jp3 disc). After (some secs) I re-connection jp3 and board sends not the time I have set before but 00.00.00 00:00:00, without increasing second(RTC stopped or not configured, reset?).