From de182b1d144accfbb43c46bcda38a761f13f0f96 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 28 May 2025 14:55:21 -0400 Subject: stm32: Support using CANBUS on PB5/PB6 on stm32h7 chips Signed-off-by: Kevin O'Connor --- src/stm32/stm32h7.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/stm32/stm32h7.c') diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c index 74732624..f65eeed7 100644 --- a/src/stm32/stm32h7.c +++ b/src/stm32/stm32h7.c @@ -49,6 +49,10 @@ lookup_clock_line(uint32_t periph_base) uint32_t bit = 1 << ((periph_base - D2_APB2PERIPH_BASE) / 0x400); return (struct cline){.en=&RCC->APB2ENR, .rst=&RCC->APB2RSTR, .bit=bit}; } else { + if (periph_base == FDCAN2_BASE) + // FDCAN1 and FDCAN2 share same clock enable + return (struct cline){.en=&RCC->APB1HENR, .rst=&RCC->APB1HRSTR, + .bit = RCC_APB1HENR_FDCANEN}; uint32_t offset = ((periph_base - D2_APB1PERIPH_BASE) / 0x400); if (offset < 32) { uint32_t bit = 1 << offset; -- cgit v1.2.3-70-g09d2