cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F401 problem RTC and debug SWD

Micha? Peterek
Associate II
Posted on December 11, 2016 at 13:34

Hi!

Immediately after reading the time from the RTC using HAL_RTC_GET_TIME RTC clock stops. Changes only position Subsecounds. The second problem is that when you first start debugging is successful but the stay and want to restart it stops at Reset_Handler:

   ldr sp = _estack / * set stack pointer * /

only helps clear the memory of the processor with ST-LINK utility.

My workbench :

Eclipse Mars 2

AC6

SW4STM32

ORGINAL STLINK
3 REPLIES 3
Micha? Peterek
Associate II
Posted on December 12, 2016 at 00:05

I fixed debugging brazing the resistor between VCC and boot0. However, the problem with the real-time clock remained.

Geoffrey1
Associate III
Posted on December 13, 2016 at 14:07

Reading the RTC is more complicated than you might think.   In order to get a consistent snapshot of time/date, there are shadow registers used to capture the current time.   Here's a comment from the Cube F3 Hal

Call HAL_RTC_GetDate() after HAL_RTC_

GetTime

() to unlock the values

 

*

       

in the higher-order calendar shadow registers.

The bottom line is that you need to read both time and data, and in that order.

In my experience it's a good idea to read the hal code for anything you are considering using.   There are frequently buried assumptions and even more frequently, the hal code is unnecessarily complex in order to cover all possible scenarios.

Posted on December 14, 2016 at 11:22

Thanks is great working !