10 years, 4 months ago.

Buffering of the RTC does not function

On the nucleo board I have open the solder jumper45. The VLED/VBAT pin I have connect a 3.0 v backup batterie.


    while(1) {  
       
time_t seconds = time(NULL);   
ak=localtime(&seconds);
      
std=ak->tm_hour;
min=ak->tm_min;
sek=ak->tm_sec; 
           }


This code is reading the time,it works. unpluging the usb or reset the board, the clock starts with 0. what's wrong ?

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

2 Answers

10 years, 4 months ago.

Do you have any crystals fitted to your board in particular the 32KHz RTC crystal? The back up cell will run the 32KHz crystal clock for the RTC when no USB power applied. At least it should do but not sure if the Mbed libraries support the RTC in this way as it does with the LPC1768 Mbed.

Accepted Answer

There ist no 32khz crystal on the nucelo board,the place on the pcb is empty. Without this crystal the rtc will not clock in "vbat mode" ? The solution is not easy, only soldering the crystal and the 2 condensers is not probably sufficient ? Then it would have to be changed the clocksource in the mbed Lib.

posted by Alfred Neumann 21 Aug 2014

Further to this, I have fitted both crystals, capacitors and links to the four boards I have, the only one that does auto detect both the the 32KHz and 8MHz crystals is the F030R8 board. However the RTC registers zero on a reset so I did not waste my time any further, not much use at all !!

posted by Paul Staron 23 Aug 2014
10 years, 4 months ago.

What is your code doing before it enters the while loop? Are you reinitialising the RTC through set_time() ? A reset or power-on will restart the entire programme and may reinit the RTC.

Initializing occurs before the loop with set time once. Then settime is commented out. Without explaining settime, nevertheless, should go on rtc, even if the usb plug is removed.

posted by Alfred Neumann 20 Aug 2014

Have you found the missing bit / switch ? I have the same problem. The external 32KHz is working.If I interrupt the power, the oscillator stops. There are still 3V on pin 1 VBAT. The same problem occurs with the backup registers. I have tested 3 different L152 boards ... ??

posted by Peter Drescher 01 Oct 2014