cancel
Showing results for 
Search instead for 
Did you mean: 

RTC_CR Daylight Saving

paulsmitton9157
Associate II
Posted on May 26, 2016 at 18:05

Hello,

Looking at the RM0090, I can read on the RTC_CR register description :

Bit 17 SUB1H: Subtract 1 hour (winter time change)
When this bit is set outside initialization mode, 1 hour is subtracted to the calendar time if the
current hour is not 0. This bit is always read as 0.
Setting this bit has no effect when current hour is 0.
0: No effect
1: Subtracts 1 hour to the current time. This can be used for winter time change.
Bit 16 ADD1H: Add 1 hour (summer time change)
When this bit is set outside initialization mode, 1 hour is added to the calendar time.
This bit is always read as 0.
0: No effect
1: Adds 1 hour to the current time. This can be used for summer time change

Is there some example of how to use these bits somewhere ? Best Regards
3 REPLIES 3
Walid FTITI_O
Senior II
Posted on May 26, 2016 at 18:57

Hi

IT4s configured inside RTC_TimeTypeDef Structure. Th following code is an example of how to attribute those parameters in Hal example.

/*##-2- Configure the Time #################################################*/ 
/* Set Time: 02:00:00 */ 
stimestructure.Hours = 0x02; 
stimestructure.Minutes = 0x00; 
stimestructure.Seconds = 0x00; 
stimestructure.TimeFormat = RTC_HOURFORMAT12_AM; 
stimestructure.DayLightSaving = RTC_DAYLIGHTSAVING_SUB1H; 
// stimestructure.DayLightSaving = RTC_DAYLIGHTSAVING_ADD1H; 
stimestructure.StoreOperation = RTC_STOREOPERATION_RESET; 
if(HAL_RTC_SetTime(&RtcHandle,&stimestructure,RTC_FORMAT_BCD) != HAL_OK) 
{ 
/* Initialization Error */ 
Error_Handler(); 
}

Referto''RTC-Calander'' example inside the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

at this path: STM32Cube_FW_F4_V1.0\Projects\STM324x9I_EVAL\Examples\RTC\RTC_Calendar -Hannibal-
paulsmitton9157
Associate II
Posted on May 27, 2016 at 16:03

Hello Hannibal

thanks for your reply

I read this, but did not found anything interresting ..

Best Regards

Walid FTITI_O
Senior II
Posted on May 27, 2016 at 16:54

Hi pipon.herve.001,

So, what is ecxactly your need ? you ought to start coding by yourself .

Start by making a little code example where you configure the RTC Timer and calender and set the bits and track results ..

-Hannibal-