/* enable LXTAL */
rcu_osci_on(RCU_LXTAL); /* wait till LXTAL is ready */
rcu_osci_stab_wait(RCU_LXTAL); /* select RCU_LXTAL as RTC clock source */
rcu_rtc_clock_config(RCU_RTCSRC_LXTAL);
/* enable RTC Clock */
rcu_periph_clock_enable(RCU_RTC); /* wait for RTC registers synchronization */
rtc_register_sync_wait(); /* wait until last write operation on RTC registers has finished */
rtc_lwoff_wait();
/* enable the RTC second interrupt*/
rtc_interrupt_enable(RTC_INT_SECOND); /* wait until last write operation on RTC registers has finished */
rtc_lwoff_wait();
/* set RTC prescaler: set RTC period to 1s */
rtc_prescaler_set(32767); /* wait until last write operation on RTC registers has finished */
rtc_lwoff_wait();
}