Repository navigation
Rtc mix mode with subseconds param. expressed in milliseconds - #93
Merged
Merged
Conversation
Contributor
Author
|
Testing examples/advancedRTCAlarm or examples/RTC_Seconds with arduino RTC sketch when the on the nucleo_wl55jc or disco_l4s5i_iot1a |
fpistm
previously requested changes
Jun 30, 2023
FRASTM
force-pushed
the
rtc_mix
branch
3 times, most recently
from
June 30, 2023 11:13
23d55e4 to
0cad1db
Compare
Contributor
Author
|
The change to include the RTC MIX mode when manipulating the subsecond register Setting an ALARM A in calendar and an alarm B in subsecond : |
Closed
fpistm
reviewed
Sep 4, 2023
FRASTM
force-pushed
the
rtc_mix
branch
8 times, most recently
from
September 8, 2023 15:07
afa27ae to
30af067
Compare
FRASTM
force-pushed
the
rtc_mix
branch
9 times, most recently
from
September 21, 2023 08:07
07b3fd4 to
0e17344
Compare
FRASTM
force-pushed
the
rtc_mix
branch
3 times, most recently
from
September 22, 2023 10:46
8ba7f1f to
e66f1d3
Compare
Contributor
Author
|
Testing on stm32g474 nucleo : RTC has BCD mode only or stm32wl55 nucleo RTC in BCD or MIX mode: Testing on stm32wl55 nucleo RTC in BIN mode: |
FRASTM
force-pushed
the
rtc_mix
branch
2 times, most recently
from
September 22, 2023 14:44
c14822f to
0d67dc0
Compare
FRASTM
marked this pull request as ready for review
September 22, 2023 16:02
Configure the alarm depending on the MIX mode In case the RTC is running in MIX mode (binary and calendar), the subsecond register is a 32-bit value (and not msec) The Subsecond parameter is expressed in millisecond in RTC_SetTime/GetTime RTC_StartAlarm/GetAlarm Signed-off-by: Francois Ramu <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
define the Getime and startAlarm function when the RTC is configured in BCD (MODE_BINARY_NONE) or BIN (MODE_BINARY_ONLY). In MODE_BINARY_ONLY, Time and Date are not used, only subsecond Signed-off-by: Francois Ramu <[email protected]>
Add new API to set alarm Time with subseconds which is a nb of milliseconds. Similar to setAlarmSubSeconds. Signed-off-by: Francois Ramu <[email protected]>
This examples is configuring the RTC in MIX (binary + calendar) or BCD and sets Alarm A & B (if exists) few ms after the current time. Signed-off-by: Francois Ramu <[email protected]>
This examples is configuring the RTC in BIN mode (binary only) and sets Alarm A & B (if exists) a few ms after the current time. Signed-off-by: Francois Ramu <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
fpistm
approved these changes
Sep 25, 2023
fpistm
left a comment
Member
There was a problem hiding this comment.
LGTM
Tested with stm32duino/STM32LoRaWAN#25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stm32duino RTC add a parameter to set binary or bcd or Mix mode
The MIX mode of the RTC combines the binary and the BCD calendar modes
"The SSR binary down-counter is extended to 32-bit length and is free running. The time and
date calendar BCD registers are also available."
This is available of several stm32 devices like the stm32WL, stm32L4plus, stm32U5
The STM32RTC APi has subsecond parameter which is a value in milliseconds.
Because of the BINARY MIX mode, the parameter subsecond could be confusing as the subsecond register of the RTC is:
a nb of millisec [0-999] in BCD mode
a nb of ticks in BIN or MIX mode -> one tick is one counter unit at the fqce = RTC clock source freq / fqce_apre
For example, in MIX mode, when RTC is clocked by the LSE (32768Hz) the tick is downcounting at 256Hz
(1 tick is ~ 3.9ms )
The RTC subsecond register is converted in ms by (0xFFFFFFFF - SubSecReg) * 1000/256
And N miliseconds is converted in ticks (count unit) by 0xFFFFFFFF - (SubSecReg * 256) /1000
With this PR, the STM32RTC API is always giving the subsecond parameter in a nb of milliseconds.
Especially with functions: