Question
STM32 CAN acceptance mask
Posted on July 27, 2015 at 14:08
Hello there,
I am trying to configure the acceptance mask of the CAN peripheral but I just cant seem to understand how does it work...CAN_FilterConfTypeDef sFilterConfig;
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 = 14; I need a 32 bit mask. I was trying to start filtering with not complicated filters like 0x01 or 0xFF that I have typed inFilterMaskIdLow
but the filter doesnt work. When 0x01 is written, it accepts everything and when 0xFF is written it doesnt accept can messages with ID 0xFF. Could someone please explain me how to use this filter? I though its like this: 32 bit filter = (FilterMaskIdHigh
<< 16) |FilterMaskIdLow
But its not. #can #filter