Home >Industry dynamics>Industry dynamics
Software and Hardware Filtering in CAN Protocol

What is CAN Protocol Filtering?

CAN filtering is a mechanism in Controller Area Networks (CAN) that controls which messages a node can receive. In a CAN network, since all nodes on the bus receive all messages transmitted, filtering is used to improve efficiency and reduce the processing load by ensuring nodes only process relevant messages. CAN filtering can be divided into software filtering and hardware filtering.

Software Filtering in CAN Protocol

Software filtering refers to the process of filtering and processing the CAN messages at the software level. In the case of our CAN bus module products, software filtering is implemented by filtering CAN IDs. For example, in our CAN-to-Ethernet devices ECAN-E01 and ECAN-E01S, we support custom filtering for 3 CAN ID channels.

Software Filtering Configuration

The software filtering is configured via the upper-level software (e.g., a host computer). Here’s how the configuration parameters are set:

  1. Enable Option: This option, when checked, enables the filter. If unchecked, the filter is inactive.

  2. Upper Limit ID (Hex): This parameter sets the maximum CAN ID that can be received, in hexadecimal format.

  3. Lower Limit ID (Hex): This parameter sets the minimum CAN ID that can be received, also in hexadecimal format.

Note: The range of receivable CAN IDs is from the Lower Limit ID to the Upper Limit ID. For example, if the Upper Limit is 3 and the Lower Limit is 1, the device will accept CAN IDs 1, 2, and 3 (in hexadecimal).

Hardware Filtering in CAN Protocol

Hardware filtering refers to filtering CAN messages at the hardware level of the CAN controller. In the case of our ECAN-E01 and ECAN-E01S CAN-to-Ethernet devices, we support up to 14 hardware filters that can be set.

Hardware Filtering Configuration

The hardware filtering is configured through the upper-level software, similar to software filtering, but it involves more precise control of the filtering process at the hardware level. The key configuration parameters are:

  1. Enable Option: This option, when checked, enables the filter. If unchecked, the filter is inactive.

  2. Filter Mode Selection: There are two types of filter modes:

    • Mask Bit Filtering: In this mode, the hardware filter uses a mask bit and an identifier to define which messages can pass through. The mask bit determines which bits must match and which can be ignored. If the identifier in the received message matches the mask bit for 1, the message can pass. If the mask bit is 0, the corresponding bit in the identifier can be ignored.

    • Identifier List Filtering: In this mode, the hardware filter uses a list of identifiers that are allowed to pass through. Only messages with an identifier that exactly matches an entry in the list will be accepted.

  3. Bit Width Selection: There are two options: 16-bit or 32-bit.

  4. IDHigh & IDLow: IDHigh refers to the high 16 bits of the CAN message identifier, and IDLow refers to the low 16 bits.

  5. MaskHigh & MaskLow: MaskHigh refers to the high 16 bits of the mask used in the hardware filter configuration, and MaskLow refers to the low 16 bits.

  6. RTR (Remote Transmission Request): The RTR bit distinguishes between data frames and remote frames. In a data frame, the RTR bit must be "dominant" (logic 0), indicating the frame contains actual data. In a remote frame, the RTR bit must be "recessive" (logic 1), indicating a request for a specific identifier without any data payload. The RTR option is set to logic 1 if enabled, otherwise it is logic 0.

  7. IDE (Identifier Extension): The IDE bit distinguishes between standard and extended frame formats. In standard frames, the IDE bit is "dominant" (logic 0), using an 11-bit identifier. In extended frames, the IDE bit is "recessive" (logic 1), using a 29-bit identifier. The IDE option is set to logic 1 if enabled, otherwise it is logic 0.

By configuring these filters, both software and hardware filtering mechanisms allow for better data handling and system performance in CAN networks, especially in scenarios with high message traffic.

Recommend