cancel
Showing results for 
Search instead for 
Did you mean: 

USB configuration conflicts with RTC_SetTime

abelloni
Associate II
Posted on October 31, 2013 at 15:08

Hi everybody,

I'm using a STM32 L152CB microcontroller with external clock. Initially I used it without USB and the RTC_SetTime worked. Since I configured the USB, the function (RTC_SetTime) doesn't work and my RTC_TimeTypeDef struct is always to 0 for each parameters (day, month, etc..)

The micro's frequency is 16Mhz and the USB's clock is 48Mhz.

Have you suggestions?

Thanks!

#rtc #clock #usb
11 REPLIES 11
kevin1078
Associate II
Posted on October 13, 2014 at 11:56

I can show all the project code if you want, but I'm afraid this will bother you since this will introduce lots of code.

kevin1078
Associate II
Posted on October 13, 2014 at 12:05

I found the root cause.  When USB enter and exit low power mode, as Suspend and Resume do, it calls stuffs like SystemInit to reinitialize the whole system. So adding reinitialization code of RTC right before RTC_SetTime solved this problem.