2024-02-22 01:40 AM
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)
Solved! Go to Solution.
2024-02-22 06:57 AM
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.
2024-02-22 06:24 AM
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.
2024-02-22 06:39 AM
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.
2024-02-22 06:57 AM
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.