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.
This commit is contained in:
Frederic Barachant 2022-04-29 09:00:30 +02:00
parent 218b5100dd
commit 8556b11125

View File

@ -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) || \