floppy
floppy

Reputation: 1

CAN standard/extended identifier mixing bug

I have a question about the STM32F439. I have set up two Can filters, the first with (standard) ID 0x700 and mask 0x780 and a second filter with (extended) ID 0x1CEF0065 and mask 0x1FFFFFFFFF. My problem is that the first filter intercepts blocks with ID 0x1CEF0065. Or to put it more generally, if the 11 bits of a standard filter match the upper 11 bits of a frame with an extended ID, it will be caught by the filter. As I understand it, this should not be the case. Filters where the IDE bit is not set should not be able to intercept blocks for which the IDE bit is set.

My filter config is the following:

CAN_FilterTypeDef sFilterConfig = {
    .FilterActivation = CAN_FILTER_ENABLE,
    .FilterBank = 0,
    .FilterFIFOAssignment = CAN_FILTER_FIFO0,
    // ID: 0x700 << 21
    .FilterIdHigh = 0xe0000,
    .FilterIdLow = 0x0000,
    // Mask: 0x780 << 21
    .FilterMaskIdHigh = 0xf000,
    .FilterMaskIdLow = 0x0000,
    .FilterMode = CAN_FILTERMODE_IDMASK,
    .FilterScale = CAN_FILTERSCALE_32BIT
};
HAL_CAN_ConfigFilter(&hcan2, &sFilterConfig);
 
CAN_FilterTypeDef sFilterConfig2 = {
    .FilterActivation = CAN_FILTER_ENABLE,
    .FilterBank = 1,
    .FilterFIFOAssignment = CAN_FILTER_FIFO0,
    // ID: 0x1CEF0065 << 3 | 1 << 2
    // The 1<<2 is the IDE-Bit
    .FilterIdHigh = 0xe778,
    .FilterIdLow = 0x032C,
    // Mask: 0x1FFFFFFF << 3 | 1 << 2
    // The 1<<2 is the IDE-Bit
    .FilterMaskIdHigh = 0xFFFF,
    .FilterMaskIdLow = 0xFFFC,
    .FilterMode = CAN_FILTERMODE_IDMASK,
    .FilterScale = CAN_FILTERSCALE_32BIT
};
HAL_CAN_ConfigFilter(&hcan2, &sFilterConfig2);

I can't explain this behaviour. Does anyone know what is going wrong here?

Upvotes: 0

Views: 30

Answers (0)

Related Questions