cancel
Showing results for 
Search instead for 
Did you mean: 

RTC_OUT lost when calling HAL_RTCEx_EnableBypassShadow for HAL || RTC_BypassShadowCmd in StdLib

ismail
Associate
Posted on October 22, 2015 at 15:03

Hi,

I'm working with STM32F0 RTC using LSE. All work perfectly till I need to map the RTC_CALIB to RTC_OUT. I succeed to get my 1Hz in RTC_OUT pin, but after a moment I lose the signal. with an investigation in my code, the signal is lost where I need to disable thebypass of RTC shadowregisters. I bypass RTC register by callingRTC_BypassShadowCmd(DISABLE).Both forRTC_BypassShadowCmd in StdLib or HAL_RTCEx_EnableBypassShadowin Cube, I find that a cast of a byte is made for bypass enable bit mask.

/* Reset the BYPSHAD bit */
RTC->CR &= (uint8_t)~RTC_CR_BYPSHAD;

and an AND operation of CR & 0x000000DF is made. So as the BYPSHAD bit is the 5st bit in CR register all other configuration bits starting from the 8st bit are cleared, thus the clear of the configuration bits of the mapping out of RTC_CALIB. I loss my alarm configuration and my mapping out by calling this function. So it's recommended that I clear the alarm, the maping out,... in the CR register before disabling the bypass? Or Can I disable the Bypass of shadow registers without resetting my half RTC config? Thanks, #rtc #stm32-rtc_b-ypassshadowcmd
1 REPLY 1
Amel NASRI
ST Employee
Posted on October 26, 2015 at 10:25

Hizemni.ismail.002,

Which STM32 device are you using? I would like to check its CMSIS peripheral access layer header file. For some STM32F4 devices,RTC_CR_BYPSHAD is defined as following:

#define RTC_CR_BYPSHAD ((uint32_t)0x00000020)

So other bits in CR register shouldn't be erased with the call of:

/* Reset the BYPSHAD bit */
RTC->CR &= (uint8_t)~RTC_CR_BYPSHAD;

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.