From 8556b111256fc293e736c3270d038f312a9fe9df Mon Sep 17 00:00:00 2001 From: Frederic Barachant Date: Fri, 29 Apr 2022 09:00:30 +0200 Subject: [PATCH] I found that the HAL implementation of a test for the CAN_FMR register is wrong. In dm00031020, chapter 32.9.4, it is said that the register can take values up to 28 in order to have all filters assigned to can1. However, in stm32F1XX_hal_can.h, the define IS_CAN_FILTER_BANK_DUAL tests it to be <=27. I do believe this test is wrong and will fail a valid call to set filters if asserts are enabled. --- Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h b/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h index e2787aa..194845f 100644 --- a/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h +++ b/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can.h @@ -795,7 +795,7 @@ HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan); #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U)) #define IS_CAN_FILTER_ID_HALFWORD(HALFWORD) ((HALFWORD) <= 0xFFFFU) #if defined(CAN2) -#define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 27U) +#define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 28U) #endif #define IS_CAN_FILTER_BANK_SINGLE(BANK) ((BANK) <= 13U) #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \