cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx RTC calendar/clock function

raptorhal2
Lead
Posted on February 17, 2015 at 15:54

There should be a pin out option to select and generate initialization code for just the RTC calendar & clock functions.

Cheers, Hal
8 REPLIES 8
kevinliao
Associate II
Posted on February 21, 2015 at 17:49

Hi, hal,

Is it a suggestion?

I have a problem in RTC code generated by CubeMx.

The RTC function can run, but can not to set date and time.

It always run the initial value. 

The RTC_TR register can not modify. 

I had disable the write protection before modify the valve of rtc register. But it not work. 

  /* Disable the write protection for RTC registers */

  __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); 

Is there has reference code to wrok?

Thank you.

Kevin 

raptorhal2
Lead
Posted on February 26, 2015 at 17:56

Yes, it is a suggestion. I expected a response from ST of yes, no, or how to do it, but no response so far.

The time and calendar setting code provided in the Cube MX initialization is just an example of how to do it. The processor does not know the time and date at run time, so you have to develop some function, such as an RS-232 link to a PC, to provide the correct setting.

Cheers, Hal

stm32cube-t
Senior III
Posted on March 05, 2015 at 11:40

Hello Hal,

By selecting the option ''Generate peripheral initialization as a pair of .c/.h files'' under Project > Project Settings > Code Generator tab, you will be able to retrieve the RTC init code in a dedicated file.

Regarding RCC configuration, it is always available in the main.c via the SystemClock_Config function.

raptorhal2
Lead
Posted on March 05, 2015 at 15:13

Thank You.   Hal

mehmetemredoruktiryaki
Associate II
Posted on July 22, 2015 at 13:03

Hi,

I think what Hal meant was that there was no way of including a

straightforward

RTC IP in the design without alarm, wakeup, calibration, route and ref. clock detection options.

An RTC only for time and calender...

Emre

michaelisaev9
Associate II
Posted on July 28, 2015 at 14:45

I think we are talking about 2 issues:

1. RTC IP can't be activated without TAMPER pin assignment. Without activation, it is not possible to assign external LSE clock for RTC. Also we can't use RTC in manual programming mode without changing SystemClock_Config code.

2. There is no option to disable setting default date time when VBAT (backup battery) is used.

Community proposes making some fixes to CubeMX to resolve these issues.

michaelisaev9
Associate II
Posted on July 28, 2015 at 14:46

I think we are talking about 2 issues:

1. RTC IP can't be activated without TAMPER pin assignment. Without activation, it is not possible to assign external LSE clock for RTC. Also we can't use RTC in manual programming mode without changing SystemClock_Config code.

2. There is no option to disable setting default date time when VBAT (backup battery) is used.

Community proposes making some fixes to CubeMX to resolve these issues.

Posted on August 04, 2015 at 13:57

Hi isaev.michael,

Concerning the first issue. If you enable the LSE clock under RCC peripheral through Pinout view, LSE can be the RTC clock without activation of the Tamper.

-Shahrzad-