cpu/stm32: reworked RTC implementation#7504
Conversation
63e9c80 to
d5e02ac
Compare
|
@haukepetersen, tested on nucleo-l053 and nucleo144-f207: works. |
cpu/stm32_common/periph/rtc.c
Outdated
| (((uint32_t)byte2bcd(time->tm_mon + 1) << 8) & (RTC_DR_MT | RTC_DR_MU)) | | ||
| (((uint32_t)byte2bcd(time->tm_mday) << 0) & (RTC_DR_DT | RTC_DR_DU))); | ||
| /* set clock to 24-h mode and enable timestamps */ | ||
| RTC->CR = RTC_CR_TSE; |
There was a problem hiding this comment.
This should be done after prescaler setting
|
It would be great if you could disable RTC output in init with this: /* Disable alternate function outputs */
RTC->TAFCR = RTC_TAFCR_TSINSEL | RTC_TAFCR_TAMPINSEL;that way we could close #7326 in favor of that one. |
|
Thanks for the tests and reviews. I optimized the driver again:
@vincent-d: I think the driver should not use any pins as it is configured now (alarm and tamper are both not enabled). So the |
|
@haukepetersen I need to check again, maybe this was because alarm was active, but I was not able to use PC13 as gpio, that's why I added that line. |
|
Which board did you encounter this on? Might be good if we find the exact cause for this... |
On our own hardware. I'm retesting, and I'll try to reproduce on a nucleo. |
|
I just found some more specific doc for the f411 (ref manual, section 8.3.15 |
|
Just checked, on the |
|
I ran some tests (on nucleo144-f207), it's becoming a bit more clear. Status is:
But if you do: /* reset configuration */
RTC->CR = 0;
RTC->ISR = 0;right after |
|
Ok, how about the change in the latest commit then? We just can't set |
Indeed! Retested your latest commit, works fine. |
|
ACK |
f0cb9d5 to
3897d00
Compare
|
squashed. |
|
ACKed and all green -> go. Thanks again for the help here! |
|
Nice one! |
Successor of #6504 and should solve #6502 in the same way.
This PR reworks the RTC driver for the STM32 family. It works now with all but the
stm32f1(which it never did, although the feature was enabled for the iotlab...). Also this rework fixes some bugs in the old driver, e.g.rtc_setdid not always work as expected.The test application got also some improvements.
What I did not check is, weather all nucleo boards have a low frequency oscillator on board, so that we can safely enable the
LSEclock for all nucleo boards. But this is something we can always do later.This PR should be tested for at least one member of each STM family. Tested so far for the
nucleo-f072stm32f3discoverynucleo-f411nucleo-l152nucleo-l476nucleo144-f746nucleo-l053nucleo144-f207Could someone verify the changes for a
stm32f2and astm32l0? Thx.