2018-12-19 09:18 PM
Hello all!
Using STM32L433, RTC is initialized with LSE, works fine.
In run, I want to switch to LSI and do certain steps and want to get back to LSE. What is the way to switch over RTC source LSE<->LSI ? I read some thing about backup domain. Please give some hint.
Thanks!
Sanket
2018-12-19 09:47 PM
It means, that you can't simply switch sources of RTC. The only way would be to read the current time/date, reset backup domain (see BDRST in the same register), if switching from LSI to LSE then start LSE, switch to the required clock source, and set up RTC completely again.
You'll lose some of the timing precision, of course; but LSI is so imprecise that this probably wouldn't really matter.
Maybe you want to tell us why do you want to do this switchover, and maybe there are better ways how to solve the problem.
JW
2018-12-19 10:06 PM
Thank you Jan Waclawek!
I am using USBMSC. Whenever I connect my custom PCB with computer USB, RTC stops working (checked by toggling port pin at every 1sec). However, this happens in some of the PCBs only. I verified that if RTC made run with LSI, it never stops working when USB is connected. So, I want to switch over to the LSI from LSE when USB interrupt is detected. Will do require things and then will get back to LSE.
Surprisingly, I still find 1.1V and 0.4V across XTAL pins, whenever RTC stops working!! I am wondering as differential voltages are coming, whether LSE is running!?
This clock switching may not be the proper solution, but as of now I cannot find any better. Would appreciate your suggestion.
Thanks!
Sanket
2018-12-20 02:39 PM
Try to mitigate the real problem rather than working around in this way. There is no reason for the RTC to stop working when connecting USB. You may have problems with power and/or grounding. Try to connect a laptop with no other cable connected.
JW