This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2cb9da8425a5bcd117935a8bbdd05b2f1dcc16ca
Author: raiden00pl <[email protected]>
AuthorDate: Wed Nov 25 14:19:50 2026 +0100

    arch/arm/stm32c5: Add FDCAN support.
    
    Use the common FDCAN v1 driver.  The board selects the FDCAN kernel
    clock with STM32_RCC_CCIPR1_FDCANSEL.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 Documentation/guides/chip-specific/stm32_ports.rst | 2 +-
 Documentation/platforms/arm/stm32c5/index.rst      | 2 +-
 arch/arm/src/stm32c5/Kconfig                       | 2 ++
 arch/arm/src/stm32c5/stm32c5xx_rcc.c               | 8 ++++++++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/guides/chip-specific/stm32_ports.rst 
b/Documentation/guides/chip-specific/stm32_ports.rst
index b07ba53bdff..1dbca1a96ac 100644
--- a/Documentation/guides/chip-specific/stm32_ports.rst
+++ b/Documentation/guides/chip-specific/stm32_ports.rst
@@ -317,7 +317,7 @@ CRS           to be done    not supported
 DAC           to be done    not supported
 DBGMCU        v5            not supported
 EXTI          M33M55 v1     
arch/arm/src/common/stm32/stm32_exti_gpio_m33m55_v1.c
-FDCAN         FDCAN         not supported
+FDCAN         FDCAN         arch/arm/src/common/stm32/stm32_fdcan_mcan_v1.c
 FLASH         to be done    not supported
 GPIO          M33M55 v1     arch/arm/src/common/stm32/stm32_gpio_m33m55_v1.c
 HASH          to be done    not supported
diff --git a/Documentation/platforms/arm/stm32c5/index.rst 
b/Documentation/platforms/arm/stm32c5/index.rst
index 8e861d39af5..24a0c2aac38 100644
--- a/Documentation/platforms/arm/stm32c5/index.rst
+++ b/Documentation/platforms/arm/stm32c5/index.rst
@@ -36,7 +36,7 @@ CRC         No
 CRS         No
 DAC         No
 DBG         No
-FDCAN       No
+FDCAN       Yes
 FLASH       No
 HASH        No
 I2C         No
diff --git a/arch/arm/src/stm32c5/Kconfig b/arch/arm/src/stm32c5/Kconfig
index 1f0983a8ee9..f0c5e001cb2 100644
--- a/arch/arm/src/stm32c5/Kconfig
+++ b/arch/arm/src/stm32c5/Kconfig
@@ -34,8 +34,10 @@ config STM32_C5_PERIPHERALS
        select ARCH_HAVE_FPU
        select STM32_HAVE_DMA1
        select STM32_HAVE_DMA2
+       select STM32_HAVE_FDCAN1
        select STM32_HAVE_IP_DMA_GPDMA
        select STM32_HAVE_IP_EXTI_M33M55_V1
+       select STM32_HAVE_IP_FDCAN_MCAN_V1
        select STM32_HAVE_IP_GPIO_M33M55_V1
        select STM32_HAVE_IP_TIMERS_V3
        select STM32_HAVE_IP_DBGMCU_V5
diff --git a/arch/arm/src/stm32c5/stm32c5xx_rcc.c 
b/arch/arm/src/stm32c5/stm32c5xx_rcc.c
index 4337d1a0ef1..a152791e0d2 100644
--- a/arch/arm/src/stm32c5/stm32c5xx_rcc.c
+++ b/arch/arm/src/stm32c5/stm32c5xx_rcc.c
@@ -207,6 +207,14 @@ void stm32_rcc_enableperipherals(void)
 #endif
   modifyreg32(STM32_RCC_APB1LENR, 0, regval);
 
+#ifdef CONFIG_STM32_FDCAN
+#  ifdef STM32_RCC_CCIPR1_FDCANSEL
+  modifyreg32(STM32_RCC_CCIPR1, RCC_CCIPR1_FDCANSEL_MASK,
+              STM32_RCC_CCIPR1_FDCANSEL);
+#  endif
+  modifyreg32(STM32_RCC_APB1HENR, 0, RCC_APB1HENR_FDCANEN);
+#endif
+
 #ifdef CONFIG_STM32_LPUART1
   modifyreg32(STM32_RCC_APB3ENR, 0, RCC_APB3ENR_LPUART1EN);
 #endif

Reply via email to