AnsweredAssumed Answered

Bank filter confinguration working ramdonly with HAL_CAN over STM32L4

Question asked by Eugenia Suarez on Mar 20, 2017
Latest reply on Apr 27, 2017 by Clive One

Working with HAL_CAN over STM32L4 polatform and kvaser (can analyzer).


I have this functions implementing my bank filtering:

void DRV_CAN_configureFiltersBank(void)

HCANFilter_Struct.FilterNumber = 0; //0 - 27
HCANFilter_Struct.FilterScale = CAN_FILTERSCALE_32BIT;

/*iid mask = 0...0 --> 0=don't care --> se acepta id con cualquier valor de bit en ese lugar*/
HCANFilter_Struct.FilterIdHigh = 0x0000; //11-bit ID in top bits ;//MSB of 32b config
HCANFilter_Struct.FilterIdLow = 0x1F;//LSB of 32b config
HCANFilter_Struct.FilterMaskIdHigh = 0x0000; //MSB
HCANFilter_Struct.FilterMaskIdLow = 0x11; //LSB

HCANFilter_Struct.FilterFIFOAssignment = 0;
HCANFilter_Struct.FilterActivation = ENABLE;
HCANFilter_Struct.BankNumber = 13;

if (HAL_CAN_ConfigFilter(&HCAN_Struct,&HCANFilter_Struct) != HAL_OK)


I would like to remark black letters. Since I have this configuration and I'm sending frames with different ID values and controller seems to get sometimes expected frames ID, but sometimes get non expected ones. Even sometimes ahs blocked correct IDs. If I understand correctly, with this configuration I have: 


  • 0x0000001F = ID value = 11111
  • 0x00000011 = mask value = 10001
  • That means all ID numbers with 1xxx1 bits at the same position will pass, but if first 1 or last one is not present that frame will not entering to my FIFO.

Is it?

The thing is that I send a frame with 10100 = ID, but this frame passes the filters and it is processed (with an eco transmition after being receiving).

Is something wrong at my configuration understanding?


Thanks in advance.