cancel
Showing results for 
Search instead for 
Did you mean: 

RTC error after updating Cuberepo 1.5 to 1.8

steevke
Associate
Posted on September 08, 2015 at 22:07

Topic says it all, I get an error in the

RTC

after updating the library version to 1.8.0 In the old

stm32f407xx

.h files I find:

/******************** Bits definition forRTC_PRERregister *****************/
#defineRTC_PRER_PREDIV_A ((uint32_t)0x007F0000)
#defineRTC_PRER_PREDIV_S ((uint32_t)0x00001FFF)

In the new

stm32f407xx

.h files I find:

/******************** Bits definition forRTC_PRERregister *****************/
#defineRTC_PRER_PREDIV_A ((uint32_t)0x007F0000)
#defineRTC_PRER_PREDIV_S ((uint32_t)0x00007FFF)

I'm unable to test right now if this is the cause of my problems but if someone can clear light on why the register definitions changed I would be grateful. I don't seem to find any mention of this in the release notes.

Thanks Steven
5 REPLIES 5
Posted on September 08, 2015 at 23:29

According to the manual, page 812, the PREDIV_S field of the RTC_PRER register is 15 bits wide. Therefore an acceptance mask should be 0x00007FFF.

Why the difference? Other than the obvious, because the new version would be correct.
Posted on September 08, 2015 at 23:33

BTW, your subject doesn't say it all, what error are you getting?

Posted on September 09, 2015 at 15:05

Hi steevke,

As

said, the value defined in this file is a mask, and RTC_PRER_PREDIV_S extends on 15 bits, that's why the value should be 0x0007FFF and not 0x0001FFF. And the correction is done since version 1.6.

And what is the faulty behaviour in tyour code caused by this change?

-Shahrzad- 

steevke
Associate
Posted on September 09, 2015 at 16:26

Hello Sharzad,

Thank you for the clarification. The error I get is HAL_TIMEOUT in HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc).

/* Wait till RTC is in INIT state and if Time out is reached exit */
while
((hrtc->Instance->ISR & RTC_ISR_INITF) == (uint32_t)RESET)
{
if
((HAL_GetTick() - tickstart ) > RTC_TIMEOUT_VALUE)
{ 
return
HAL_TIMEOUT;
} 
}

I only get the error when reseting, if I power down/up the RTC inits OK. Edit: using 1.5.0 the RTC inits OK, with 1.8.0 not.
Posted on September 11, 2015 at 17:24

Hi  steevke,

After searching differences between stm32f4xx_hal_rtc.c driver in  1.5.0 and 1.8.0, there is no

difference in the function RTC_EnterInitMode. There is a modification in the function HAL_RTC_GetTime() which can not be the reason of the dispalyed error.

Try to keep your code with the pachakge 1.8.0 and modify the value of  RTC_PRER_PREDIV_S, so you can see if this modification is the source of error.

-Shahrzad-