2017-10-09 04:52 AM
@
Hi,
I did my project in cubemx with STM32F405.
But unfortunately i forgot to add/initialize rtc in cubemx.
Now i want to add rtc in my project.
And i don't know how to add it (because my code size is too much heavy and i dont want to do rework in cubemx).
Can you please tell me how can i do this without cubemx?
Thank you.
#
2017-10-16 03:14 AM
RTC starts working.
when i compared stm32f405 rtc time with my dell laptop rtc then i observed on an average for a every 1 min 3 seconds are added extra.
(for 20 min. 1 min. added extra!!)
stm32f405 rtc time is moves faster than server time.
how can i control this?
Thank you.
2017-10-16 04:22 AM
Thank you.
2017-10-16 05:22 AM
use a 32k external oscillator/crystal for LSE to drive the RTC
2017-10-17 04:31 AM
I'm already using 32.768kHz crystal for same.
Till this problem is observed.
2017-10-29 12:16 AM
Hello,
Now i'm using 3V battery supp;ly for RTC when there no power supply.
But when i switch off power supply rtc stuck at that time.
When i switch on power rtc time start from that stuck time.
As per protocol rtc should work on battery and also update date and time.
Point-1:Power ON with Battery
Time:11:40:20 Date:29/10/2017
Point-2:
After Switching off power supply for 10 min.
Date and Time should be
Time:11:50:20 Date:29/10/2017
but it is same as Time:11:40:20 Date:29/10/2017
please help.
My RTC Initialization code is:-
void MX_RTC_Init(void)
{ unsigned int Status; Status = 1; hrtc.Instance = RTC; hrtc.Init.HourFormat = RTC_HOURFORMAT_24; hrtc.Init.AsynchPrediv = 127; hrtc.Init.SynchPrediv = 255; //hrtc.Init.OutPut = RTC_OUTPUT_DISABLE; hrtc.Init.OutPut = RTC_OUTPUT_WAKEUP; hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; sTime.Hours = 0x10; sTime.Minutes = 0x10; sTime.Seconds = 0x10; sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; sTime.StoreOperation = RTC_STOREOPERATION_SET; sDate.WeekDay = RTC_WEEKDAY_MONDAY; sDate.Month = 0x08; sDate.Date = 0x15; sDate.Year = 0x47; Status = HAL_RTC_Init(&hrtc); while(Status != HAL_OK) { Status = HAL_RTC_Init(&hrtc); }if(HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR0) != 0x32F2){
sTime.Hours = 0x10; sTime.Minutes = 0x10; sTime.Seconds = 0x10; sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; sTime.StoreOperation = RTC_STOREOPERATION_SET; Status = 1; Status = HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD); while(Status != HAL_OK) { Status = HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD); } sDate.WeekDay = RTC_WEEKDAY_MONDAY; sDate.Month = 0x08; sDate.Date = 0x15; sDate.Year = 0x47; Status = 1; Status = HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD); while(Status != HAL_OK) { Status = HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD); } HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR0,0x32F2); } /**Enable Calibrartion*/ if (HAL_RTCEx_SetCalibrationOutPut(&hrtc, RTC_CALIBOUTPUT_1HZ) != HAL_OK) {_Error_Handler(__FILE__, __LINE__); }}2017-10-29 03:14 AM
Are you sure your RTC's clock is LSE and not LSI?
Read out and post content of RCC_BDCR.
JW