aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stm32/fdcan.c11
-rw-r--r--src/stm32/stm32g4.c6
2 files changed, 15 insertions, 2 deletions
diff --git a/src/stm32/fdcan.c b/src/stm32/fdcan.c
index b0e8c01d..5344d26b 100644
--- a/src/stm32/fdcan.c
+++ b/src/stm32/fdcan.c
@@ -60,16 +60,23 @@
|| CONFIG_STM32_CANBUS_PB5_PB6 ||CONFIG_STM32_CANBUS_PB12_PB13)
#define SOC_CAN FDCAN1
#define MSG_RAM (((struct fdcan_ram_layout*)SRAMCAN_BASE)->fdcan1)
+ #if CONFIG_MACH_STM32H7 || CONFIG_MACH_STM32G4
+ #define CAN_IT0_IRQn FDCAN1_IT0_IRQn
+ #endif
#else
#define SOC_CAN FDCAN2
#define MSG_RAM (((struct fdcan_ram_layout*)SRAMCAN_BASE)->fdcan2)
+ #if CONFIG_MACH_STM32H7 || CONFIG_MACH_STM32G4
+ #define CAN_IT0_IRQn FDCAN2_IT0_IRQn
+ #endif
#endif
#if CONFIG_MACH_STM32G0
#define CAN_IT0_IRQn TIM16_FDCAN_IT0_IRQn
#define CAN_FUNCTION GPIO_FUNCTION(3) // Alternative function mapping number
-#elif CONFIG_MACH_STM32H7 || CONFIG_MACH_STM32G4
- #define CAN_IT0_IRQn FDCAN1_IT0_IRQn
+#endif
+
+#if CONFIG_MACH_STM32H7 || CONFIG_MACH_STM32G4
#define CAN_FUNCTION GPIO_FUNCTION(9) // Alternative function mapping number
#endif
diff --git a/src/stm32/stm32g4.c b/src/stm32/stm32g4.c
index 139ea8ea..1eed3ec1 100644
--- a/src/stm32/stm32g4.c
+++ b/src/stm32/stm32g4.c
@@ -22,6 +22,12 @@ lookup_clock_line(uint32_t periph_base)
if (periph_base < APB2PERIPH_BASE) {
uint32_t pos = (periph_base - APB1PERIPH_BASE) / 0x400;
if (pos < 32) {
+#if defined(FDCAN2_BASE)
+ if (periph_base == FDCAN2_BASE)
+ return (struct cline){.en = &RCC->APB1ENR1,
+ .rst = &RCC->APB1RSTR1,
+ .bit = 1 << 25};
+#endif
return (struct cline){.en = &RCC->APB1ENR1,
.rst = &RCC->APB1RSTR1,
.bit = 1 << pos};