Skip to content

Commit ff8fea4

Browse files
gmarullMaureenHelm
authored andcommitted
drivers: counter: stm32: enable support for H7 series
Enable counter driver support for H7 series. Tested with H743ZI MCU using samples/drivers/counter/alarm. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent e70de6e commit ff8fea4

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

drivers/counter/Kconfig.stm32_rtc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ menuconfig COUNTER_RTC_STM32
1212
select USE_STM32_LL_EXTI
1313
select REQUIRES_FULL_LIBC
1414
help
15-
Build RTC driver for STM32 SoCs. Tested on STM32 F3, F4, L4, F7, G4 series
15+
Build RTC driver for STM32 SoCs. Tested on STM32 F3, F4, L4, F7, G4, H7 series
1616

1717
choice COUNTER_RTC_STM32_CLOCK_SRC
1818
bool "RTC clock source"

drivers/counter/counter_ll_stm32_rtc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ LOG_MODULE_REGISTER(counter_rtc_stm32, CONFIG_COUNTER_LOG_LEVEL);
3131
|| defined(CONFIG_SOC_SERIES_STM32F7X) \
3232
|| defined(CONFIG_SOC_SERIES_STM32WBX) \
3333
|| defined(CONFIG_SOC_SERIES_STM32G4X) \
34-
|| defined(CONFIG_SOC_SERIES_STM32L1X)
34+
|| defined(CONFIG_SOC_SERIES_STM32L1X) \
35+
|| defined(CONFIG_SOC_SERIES_STM32H7X)
3536
#define RTC_EXTI_LINE LL_EXTI_LINE_17
3637
#endif
3738

dts/arm/st/h7/stm32h7.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@
226226
status = "disabled";
227227
label = "UART_8";
228228
};
229+
230+
rtc: rtc@58004000 {
231+
compatible = "st,stm32-rtc";
232+
reg = <0x58004000 0x400>;
233+
interrupts = <41 0>;
234+
clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00010000>;
235+
prescaler = <32768>;
236+
status = "disabled";
237+
label = "RTC_0";
238+
};
229239
};
230240
};
231241

soc/arm/st_stm32/stm32h7/dts_fixup.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@
181181
#define DT_UART_STM32_UART_8_CLOCK_BUS DT_ST_STM32_UART_40007C00_CLOCK_BUS
182182
#define DT_UART_STM32_UART_8_HW_FLOW_CONTROL DT_ST_STM32_UART_40007C00_HW_FLOW_CONTROL
183183

184+
#define DT_RTC_0_BASE_ADDRESS DT_ST_STM32_RTC_58004000_BASE_ADDRESS
185+
#define DT_RTC_0_IRQ_PRI DT_ST_STM32_RTC_58004000_IRQ_0_PRIORITY
186+
#define DT_RTC_0_IRQ DT_ST_STM32_RTC_58004000_IRQ_0
187+
#define DT_RTC_0_NAME DT_ST_STM32_RTC_58004000_LABEL
188+
#define DT_RTC_0_CLOCK_BITS DT_ST_STM32_RTC_58004000_CLOCK_BITS
189+
#define DT_RTC_0_CLOCK_BUS DT_ST_STM32_RTC_58004000_CLOCK_BUS
190+
184191
#define DT_WWDT_0_BASE_ADDRESS DT_INST_0_ST_STM32_WINDOW_WATCHDOG_BASE_ADDRESS
185192
#define DT_WWDT_0_NAME DT_INST_0_ST_STM32_WINDOW_WATCHDOG_LABEL
186193
#define DT_WWDT_0_IRQ DT_INST_0_ST_STM32_WINDOW_WATCHDOG_IRQ_0

soc/arm/st_stm32/stm32h7/soc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
#include <stm32h7xx_ll_utils.h>
6565
#endif
6666

67+
#ifdef CONFIG_COUNTER_RTC_STM32
68+
#include <stm32h7xx_ll_rtc.h>
69+
#include <stm32h7xx_ll_exti.h>
70+
#include <stm32h7xx_ll_pwr.h>
71+
#endif /* CONFIG_COUNTER_RTC_STM32 */
72+
6773
#endif /* !_ASMLANGUAGE */
6874

6975
#endif /* _STM32F7_SOC_H7_ */

0 commit comments

Comments
 (0)