STM32 CAN driver Topic is solved
Posted: Tue Oct 08, 2019 6:01 pm
Hi,
There's a bug in the current CAN driver (stable 19.1.x) when only using CAN3
A simple fix is to add #if before the block like this:
There's a bug in the current CAN driver (stable 19.1.x) when only using CAN3
Code: Select all
ChibiOS/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c: In function 'can_lld_init':
ChibiOS/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c:661:24: error: 'CAND1' undeclared (first use in this function); did you mean 'CAND3'?
can_lld_set_filters(&CAND1, STM32_CAN_MAX_FILTERS / 2, 0, NULL);
^~~~~
CAND3
A simple fix is to add #if before the block like this:
Code: Select all
#if STM32_CAN_USE_CAN1
#if STM32_HAS_CAN2
can_lld_set_filters(&CAND1, STM32_CAN_MAX_FILTERS / 2, 0, NULL);
#else
can_lld_set_filters(&CAND1, STM32_CAN_MAX_FILTERS, 0, NULL);
#endif
#endif