bxCAN acceptance filter configuration.
Hi,
I'm using CubeMX to init CAN module, everything is working, I can send and receive messages.
Now I would like to configure filter to accept only message with specified ID.
So, I have this piece of code generated by CUBE:
//sFilterConfig.FilterNumber = 0;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterIdHigh = 0x0000;
sFilterConfig.FilterIdLow = 0x0000;
sFilterConfig.FilterMaskIdHigh = 0x0000;
sFilterConfig.FilterMaskIdLow = 0x0000;
sFilterConfig.FilterFIFOAssignment = 0;
sFilterConfig.FilterActivation = ENABLE;
//sFilterConfig.BankNumber = 0;
sFilterConfig.FilterBank = 0;
sFilterConfig.SlaveStartFilterBank = 0;
HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);
When I'm using this code I can accept all frames.
Like I said I need to accept only messages with specified, extended ID, for example 0x12F0AAAA, so I'm changing this lines:
sFilterConfig.FilterIdHigh = 0x12F0;
sFilterConfig.FilterIdLow = 0xAAAA;
sFilterConfig.FilterMaskIdHigh = 0x1FFF;
sFilterConfig.FilterMaskIdLow = 0xFFFF;
but when I configure filter like that I can not receive this message.
Can somebody help me with this case, I have checked web and documentation but everything seems to be ok.
Thanks, Daniel
