I am using nRF5340 RTC with external crystal. I have verified with following piece of code that LXFO is working. During normal scenario RTC is working fine as a counter.
union {
unsigned int raw;
nrf_clock_lfclk_t lf;
nrf_clock_hfclk_t hf;
} src;
enum clock_control_status clkstat;
bool running;
clkstat = clock_control_get_status(clock0, CLOCK_CONTROL_NRF_SUBSYS_LF);
running = nrf_clock_is_running(NRF_CLOCK, NRF_CLOCK_DOMAIN_LFCLK, &src.lf);
I want to retain the RTC counter value when there is software reset e.g NVIC_SystemReset. Is it possible to achieve it with external crystal clock enabled?
Also we have two RTC peripherals in nRF5340, Is there anyway we can implement the Real time clock using both RTCs? Or we must have to use the external RTC for clock purpose?