Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


STM32F103C8T6 RTC year keeps defaulting to 2000, time however OK

Strange problem.
The RTC seems to be working.
Once set up, the RTC time is working but when CPU does power cycle, the time is OK, but the year keeps defaulting to 2000.

It is probably I’m doing something wrong.

I set the clock using MX_RTC_Init() which has the time and date hard coded into it from the defaults it receives from STM23CubeMX setup.

The next time I run, I don’t run MX_RTC_Init()
(If I did, the hard coded time will be written back into the RTC).

and then run HAL_RTC_GetTime(&hrtc, &RTC_Time, RTC_FORMAT_BIN);
which fetches the battery backed time - the time is correct.

At this point, I am assuming all the data structures have initialised
properly even though I have not run MX_RTC_Init()

and then I do HAL_RTC_GetDate(&hrtc, &RTC_Date, RTC_FORMAT_BIN);
this however has defaulted the year to 2000.

This default date is being set I think in
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc) which is in file stm32f1xx_hal_rtc.c
(I don’t think we are supposed to modify this file.)

The time function is OK, so Is there some step I missed to get the corret date out of the RTC?

TIA

I have the same problem. Could you solve it?
I miss the date, but the time is still working correctly.


I don’t know if this is still true but, a while back the initialization code for the RTC would set the date. There was no “unitialized” flags being used to bypass the setting of the date. It seemed like an odd choice and the problem was sent to ST, but I never followed the issue.

Put some break points in the startup code and see if the RTC has the proper date, then step through. It sounds like that init code is still around.

Andrei


Thanks for reply.

After of read tons of documentation and forums, I decided don’t spend more time and use an external clock DS1307.

Apparently the STM32F103 does not have calendar functions, and only has one counter for seconds. Because date reset when reset device. We need implement calendar by software, but the accuracy of RTC was also not convincing me, calculating if it was delayed 5 minutes per day.

When I get my discovery with stm32f4 and have time, I will test if the calendar works. Meanwhile I need to continue with the project. biggrin


Thank skalibur - yours is best answer - I go use DS1307 to resurect the original project.