From 21b7bd9f44a1e9dff2881b8aa1c72f400d3c7c39 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 23 May 2024 17:46:47 +1000 Subject: [PATCH] stm32/fdcan: Fix extended CAN ID filtering for stm32g4. The memory bank addresses used for these are independent, can (and must) enable both. Also looks like no need to shrink these if FDCAN2 is added, the Reference Manual is a bit unclear but looks like the peripheral's RAM multiplies out for each additional controller. Signed-off-by: Angus Gratton --- ports/stm32/fdcan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c index 26a886098..04d8135c0 100644 --- a/ports/stm32/fdcan.c +++ b/ports/stm32/fdcan.c @@ -86,8 +86,8 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ init->DataSyncJumpWidth = 1; init->DataTimeSeg1 = 1; init->DataTimeSeg2 = 1; - init->StdFiltersNbr = 28; // /2 ? if FDCAN2 is used !!? - init->ExtFiltersNbr = 0; // Not used + init->StdFiltersNbr = 28; + init->ExtFiltersNbr = 8; init->TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; #elif defined(STM32H7) // The dedicated FDCAN RAM is 2560 32-bit words and shared between the FDCAN instances.