cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0 RTC

awahba
Associate II
Posted on March 31, 2015 at 17:08

Hello,

I am trying to read the RTC time after setting it up. I am experiencing weird behavior.

I am using the STM32L0 discovery board.

I am using the new HAL libraries and the RTC alarm example.

I am using internal LSI and set the prescaler accordingly, per an app note.

I am using IAR

The alarm is working all the time, I can see the interrupt fire at the end of a minute delay,  so I know the clock is actually working

However, I am trying to periodically read the current time using the following code:

//get time  

    if(HAL_RTC_GetTime(&RtcHandle,&currenttimestructure,FORMAT_BIN)==HAL_OK)

    {

     

      sprintf((char *) statusline,''%2d:%2d:%2d'',currenttimestructure.Hours,currenttimestructure.Minutes,currenttimestructure.Seconds);

    }

    else

    {

      sprintf((char *) statusline,''error'');

    }

 HAL_Delay(5000);

The problem: 

if I set a breakpoint in the code, I see the RTC_TR update and the time is updated on the epd display

If I remove the breakpoint, the currenttime structure is never updated.

Thanks,

Ashraf

#stm32-rtc
1 REPLY 1