bxCAN Filters config: In case of single instance of CAN peripheral, 14 filter banks are available to filter CAN1 messages. We can assign any filter to any FIFO. The received and accepted message will be available in one of the three receive mailbox of the FIFO that was assigned to the filter that accepted the message. In case of DUAL instances of CAN peripheral (CAN1 and CAN2), 28 filter banks are available to filter CAN messages. In that case Filters are shared between the two instances. .SlaveStartFilterBank member in the structure in the driver defines the number of filters allocated to CAN1 and CAN2. It sets CAN2SB field in CAN_FMR. The value of CAN2SB can be seen as "a cursor" that configures the amount of filters allocated to CAN1 and CAN2. - If CAN2SB (.SlaveStartFilterBank) = 14: 14 filters are allocated to CAN1 (Filter 0 to 13) and 14 filters are allocated to CAN2 (Filter 14 to 27). - If CAN2SB (.SlaveStartFilterBank) = 28: all filters are allocated to CAN1. In that case CAN2 will be not used. - If CAN2SB (.SlaveStartFilterBank) = 0: all filters are allocated to CAN2. In that case CAN1 will be not used but CAN1 APB clock should be enabled since it's a master (from implementation point of view) and it manages the filtering part. Case 1: CAN2SB = 14 (cursor set to 14) | |------CAN1 part------14-------CAN2 part-----| 0 27 \_____________________/\_____________________/ Filters allocated Filters allocated to CAN1 to CAN2 Case 2: CAN2SB = 0 (cursor set to 0) | |-------------------------------------------| 0 27 \___________________________________________/ All filters are allocated to CAN2 Case 3: CAN2SB = 28 (cursor set to 28) | |-------------------------------------------| 0 27 \___________________________________________/ All filters are allocated to CAN1 Case 4: CAN2SB = 9 (cursor set to 9) | |-CAN1 part--9-----------------CAN2 part-----| 0 27 \___________/\______________________________/ 9 Filters 18 Filters allocated allocated to CAN2 to CAN1 Regarding .FilterBank and .SlaveStartFilterBank parameters in the filter structure in the driver: - For CAN1: .FilterBank should be always < .SlaveStartFilterBank. - For CAN2: .FilterBank should be always >= .SlaveStartFilterBank. For devices having three CAN instances. CAN1/CAN2 have the configuration of DUAL configuration. CAN3 is a master and it's independent from CAN1/CAN2 and it has its own filters.