Hi guys,
I've been doing some work on the real time clock API but for some reason
I cannot get it to work.
I am trying to write an example that uses the LSE as the RTC clock and
uses alarm interrupts to flash an LED.
Most of the time the code hangs while waiting for the LSE to stabilize
or when waiting for RTC registers to synchronise.
Here is an example of all i'm trying to do:
void clock_setup()
{
RCC_APB1ENR |= (PWREN |BKPEN); //enable backup domain clock
pwr_enable_backup_domain_write();
//reset backup domain
RCC_BDCR |= BDRST;
RCC_BDCR &= ~BDRST;
rcc_osc_on(LSE); //enable LSE
rcc_wait_for_osc_ready(LSE); //wait until lse is stable
rtc_set_clock_source(LSE); //set LSE as RTC clock source
rtc_enable(); //enable real time clock
}
once this is working i can then call the prescaler and counter functions
I have written.
Have any of you had any success with libopenstm32 and RTC?
Thanks for your help
Mark Butler
|