Commit graph zephyr/drivers/counter/counter_stm32_rtc.c
Author SHA1 Message Date
Anas Nashif
25064db654 drivers: counter: stm32_rtc: use portable IRQ pending API
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending().

Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-27 22:12:33 -04:00
Benjamin Cabé
87f047afb3 drivers: counter: stm32_rtc: Fix HSE async prescaler macro name
The async-prescaler default referenced _HSE_ASYNC_PRESCALER, a
truncated spelling of RTC_HSE_ASYNC_PRESCALER that is defined
nowhere, breaking the build for HSE-clocked RTC configurations
without the async-prescaler property.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-20 08:37:46 -05:00
Mathieu Choplain
63da9b5dbf drivers: counter: stm32_rtc: manage EXTI line in a proper manner
Instead of hardcoded EXTI line numbers and raw LL API calls, align the
STM32 RTC Counter driver with its Real-Time Clock counterpart:
- obtain EXTI line number from Devicetree
- use the EXTI INTC API instead of raw LL API calls

Fixes the build issue observed on STM32N6.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-05-07 18:12:51 -05:00
Guillaume Gautier
1ed9563804 drivers: counter: stm32: rtc: adapt rtc driver for stm32 hal2
STM32 HAL2 adopts some new syntaxes so the Counter RTC driver needs to be
updated.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-03-20 20:43:57 +09:00
Mathieu Choplain
a11688fab5 drivers: *: stm32: don't check if clock device is ready
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-13 18:59:16 +00:00
Guillaume Gautier
f135f10d6c drivers: counter: stm32: replace ll_func_* by ll_*
Replace ll_func_* by ll_* for LL function redefinitions in the STM32
counter driver.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-02-12 20:04:25 +01:00
Benjamin Cabé
ef79c52871 drivers: counter: use proper essential type in bool variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Antoine Pradoux
c10819f93a drivers: rtc: stm32: Add STM32U3 support for RTC alarm, clock & counter
Extend RTC driver to handle STM32U3 series specifics:
- Include STM32U3X in condition where RTC Alarm event is not routed to EXTI
- Use LL_RCC_RTC_ClockEnable call for STM32U3 instead of LL_RCC_EnableRTC
- Adapt counter_stm32_rtc driver for STM32U3 clock and EXTI handling

Signed-off-by: Antoine Pradoux <antoine.pradoux@st.com>
2026-01-22 13:00:57 -05:00
Adrien Lessard
2cc9d794dc drivers: counter: stm32: fix rtc subsecond register read
According to the reference manual, 'When the BYPSHAD control bit is set
in the RTC_CR register [...] the value of one of the registers may be
incorrect if an RTCCLK edge occurs during the read operation'. We need
to read te subseconds register until two successive reads are equal.

Signed-off-by: Adrien Lessard <adrien.lessard.42@gmail.com>
2025-12-20 09:20:11 +01:00
Mathieu Choplain
96632cd686 drivers: counter: stm32: remove ll in drivers' file name
The `ll` part of drivers' file name indicates that the implementation uses
the STM32Cube Low Level ("LL") library, which is not interesting because
there is only *one* STM32 driver implementation anyways (per IP variant).
Addtionnally, the presence of `ll` among STM32 drivers is not consistent.

Get rid of it for drivers of this class to match most other STM32 drivers.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-04 14:00:34 -05:00
Renamed from drivers/counter/counter_ll_stm32_rtc.c (Browse further)