-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement a One-Second interrupt on stm32 MCUs #57
Conversation
The stm32 MCUs have different name/ position for the wakeUp interrupt to be used as the one-second interrupt ; defining single ONESECOND_IRQn depending on the soc serie |
The stm32 MCUs have different name/ position for the wakeUp interrupt to be used as the one-second interrupt ; defining single ONESECOND_IRQn depending on the soc serie |
ad28be4
to
871786c
Compare
Note that STM32F030x4/6, STM32F070x6 and STM32F030x8 devices do not have WakeUp feature in their RTC and only one Alarm |
c9c7e96
to
0895dd7
Compare
Ada a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First please rebase on top of the main to avoid to have the get/set prescaler commits.
Fix the build issues raised by the STM32RTC Continuous Integration / Library compilation, example:
/github/home/Arduino/libraries/workspace/src/rtc.c: In function 'attachSecondsIrqCallback':
/github/home/Arduino/libraries/workspace/src/rtc.c:757:46: error: 'RTC_WAKEUPCLOCK_CK_SPRE_16BITS' undeclared (first use in this function); did you mean 'LL_RTC_WAKEUPCLOCK_CKSPRE_WUT'?
757 | HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
/github/home/Arduino/libraries/workspace/src/rtc.c:757:46: note: each undeclared identifier is reported only once for each function it appears in
Error during build: exit status 1
| 2/45 | NUCLEO_F031K6 | failed | 4.82 s |
/github/home/Arduino/libraries/workspace/src/rtc.c: In function 'attachSecondsIrqCallback':
/github/home/Arduino/libraries/workspace/src/rtc.c:757:46: error: 'RTC_WAKEUPCLOCK_CK_SPRE_16BITS' undeclared (first use in this function); did you mean 'LL_RTC_WAKEUPCLOCK_CKSPRE_WUT'?
757 | HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
/github/home/Arduino/libraries/workspace/src/rtc.c:757:46: note: each undeclared identifier is reported only once for each function it appears in
Error during build: exit status 1
| 3/45 | NUCLEO_F042K6 | failed | 5.20 s |
rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think to update the README.md
The code added for this feature is under |
A callback function is attached for this interrupt The same callback is referenced whatever the device (stm32F1 or other stm32 soc) Signed-off-by: Francois Ramu <francois.ramu@st.com>
The stm32F1 device has specific one-second interrupt. For stm32 devices that do not have a seconds interrupt the RTC WakeUp is programmed to interrupt the system on a one-second period. The HAL_RTCEx_WakeUpTimerEventCallback is called instead keeping the same naming RTCSecondsIrqCallback. Some stm32F0 mcus do not support the wakeUp feature. Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Francois Ramu <francois.ramu@st.com>
updates the README.md |
enable the second interrupt and display time each second, thanks to its callback function Raise an error if the sketch not running on the devices (not stm32F1 and no wakeUp interrupt available) Signed-off-by: Francois Ramu <francois.ramu@st.com>
This Enhancement is adding a interrupt on each second for the stm32xx MCUs
for the stm32F1 : the RTC One-Second flag interrupt is asserted on each RTC Core 1Hz clock cycle
for other MCUS the RTC WakeUP feature is programmed to interrupt each second
depending on the stm32 serie, this interrupt channel is a global or a specific one.
In the the stm32F0xx serie, other than STM32F071xB, STM32F072xB, STM32F078xx, STM32F091xC, STM32F098xx, STM32F070xB, STM32F030xC do not support the WakeUp capability.
A simple example RTC_Seconds demonstrating the feature with a basic callback function that toggle a bit each second
This test is passed on stm32F1 (nucleo f103rb), stm32G4 (nucleo g474re), stm32L4 (nucleo l476rg), stm32WB (nucleo wb55rg), stm32L1 (nucleo l152re), stm32F7 (nucleo 144 f767zi)
This PR is inspired by the #42
Signed-off-by: Francois Ramu francois.ramu@st.com