cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 HAL_RTCEx_WakeUpTimerIRQHandler

TLin.5
Associate III

While looking at the HAL's RTC code, I noticed that in the IRQ handler for WakeUpTimer, there is no enabling of access to backup domain registers before clearing flag WUTF in RTC register ISR...

Should this not be needed?

When testing in my own implementation, WUTF flag cannot be cleared unless I first enable access to the backup domain registers.

The reference manual (RM0090) does not feel very clear about if this is needed for clearing WUTF.

(this is just one of numerous issues I have with the HAL RTC code and the documentation, but I feel that I may need to know more to determine if it's an error in the HAL code)

1 ACCEPTED SOLUTION

Accepted Solutions

That's the difference then. If you disable access, you will need to re-enable it before clearing the flag. HAL examples leave it enabled. You can follow their lead, or you can enable access prior to clearing WUTF.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

If the RTC is already set up, backup domain access should already be enabled. Are you disabling it after configuring things? You can see how it's done in the CubeMX examples and go off of those.

https://github.com/STMicroelectronics/STM32CubeF4/blob/5d9f72cc837d76d96b3236d5e4d644e177092df2/Projects/STM324xG_EVAL/Examples/PWR/PWR_CurrentConsumption/Src/main.c

 

If you feel a post has answered your question, please click "Accept as Solution".
TLin.5
Associate III

In my existing application backup domain access is only enabled when needed and then disabled immediately after... 
While I was not the one who wrote that part of the code originally, I've been assuming that there is a reason for why it is not on all the time.

That's the difference then. If you disable access, you will need to re-enable it before clearing the flag. HAL examples leave it enabled. You can follow their lead, or you can enable access prior to clearing WUTF.

If you feel a post has answered your question, please click "Accept as Solution".