libopencm3 icon indicating copy to clipboard operation
libopencm3 copied to clipboard

rtc_enable_wakeup_timer() also enables wakeup output on f4 RTC

Open sbrk-r opened this issue 3 years ago • 2 comments

It took me a while to figure out why a GPIO that happens to be RTC_OUT as AF kept breaking when I'd try to enable RTC wakeup interrupt on an f401 board. I'm not really convinced it should call rtc_enable_wakeup_timer_interrupt() either, but at least that is possibly expected. The brief should probably note that, if it really is desired. From the name and brief I expected it to just set RTC_CR_WUTE.

@brief Enable the wakeup timer @warning You must unlock the registers before using this function

*/ void rtc_enable_wakeup_timer(void) { RTC_CR |= RTC_CR_WUTE | (RTC_CR_OSEL_WAKEUP << RTC_CR_OSEL_SHIFT); rtc_enable_wakeup_timer_interrupt(); }

from the ref manual:

The OSEL[1:0] control bits in the RTC_CR register are used to activate the alarm alternate function output (RTC_ALARM) in RTC_AF1, and to select the function which is output on RTC_ALARM.

[...]

Note: When RTC_CALIB or RTC_ALARM is selected, RTC_OUT is automatically configured in output alternate function.

sbrk-r avatar Jun 02 '22 21:06 sbrk-r

Almost a full year on this one. Any opinions on whether this is desired behaviour, for some reason?

sbrk-r avatar May 14 '23 04:05 sbrk-r

Am I supposed to decide for us and put a PR?

sbrk-r avatar Apr 08 '24 05:04 sbrk-r