mikroSDK Reference Manual
can_filter_config_t Struct Reference

CAN filter init configuration structure. More...

Data Fields

union {
   struct {
      uint16_t   can_filter_id_low
 
      uint16_t   can_filter_id_high
 
   } 
 
   uint32_t   can_filter_id
 
}; 
 
union {
   struct {
      uint16_t   can_filter_mask_id_low
 
      uint16_t   can_filter_mask_id_high
 
   } 
 
   uint32_t   can_filter_mask_id
 
}; 
 
uint8_t can_filter_bank
 
can_frame_type_t can_filter_frame_type [4]
 
can_filter_activation_t can_filter_enable
 
can_filter_mode_t can_filter_mode
 
can_filter_scale_t can_filter_scale
 
can_filter_fifo_t can_filter_fifo
 

Detailed Description

User needs to specify values herein.

Note
Take into consideration that any value can be changed explicitly by the user. Based on the user input, SW will define either extended or standard frame ID should be chosen for filter configuration.

16-bit ID and Mask structure variables for ARM MCUs: CAN_FILTER_MODE_IDMASK and CAN_FILTER_SCALE_32BIT - user is configuring 1 32-bit filter with mask:

  • Filter(n) ID is can_filter_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[0] |______________________|___________| variable) EID[17:0] SID[10:0]
  • Filter(n) Mask is can_filter_mask_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[1] |______________________|___________| variable) EID[17:0] SID[10:0]

CAN_FILTER_MODE_IDLIST and CAN_FILTER_SCALE_32BIT - you user is configuring 2 32-bit filters without masks:

  • Filter(n) ID is can_filter_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[0] |______________________|___________| variable) EID[17:0] SID[10:0]
  • Filter(n+1) ID is can_filter_mask_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[1] |______________________|___________| variable) EID[17:0] SID[10:0]

CAN_FILTER_MODE_IDMASK and CAN_FILTER_SCALE_16BIT - user is configuring 2 16-bit filters with masks:

  • Filter(n) ID is can_filter_id_low (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[0] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n) Mask is can_filter_mask_id_low (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[1] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n+1) ID is can_filter_id_high (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[2] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n+1) Mask is can_filter_mask_id_high (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[3] |___|___________| variable) EID[17:15] SID[10:0]

CAN_FILTER_MODE_IDLIST and CAN_FILTER_SCALE_16BIT - user is configuring 4 16-bit filters:

  • Filter(n) ID is can_filter_id_low (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[0] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n) ID is can_filter_mask_id_low (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[1] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n+1) ID is can_filter_id_high (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[2] |___|___________| variable) EID[17:15] SID[10:0]
  • Filter(n+1) ID is can_filter_mask_id_high (frame type is defined 0b0011 1111 1111 1111 with can_filter_frame_type[3] |___|___________| variable) EID[17:15] SID[10:0]

16-bit ID and Mask structure variables for PIC MCUs:

  • Filter(n) ID is can_filter_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[0] |______________________|___________| variable) EID[17:0] SID[10:0]
  • Filter(n) Mask is can_filter_mask_id (frame type is defined 0b0001 1111 1111 1111 1111 1111 1111 1111 with can_filter_frame_type[1] |______________________|___________| variable) EID[17:0] SID[10:0]

Example

// CAN filter configuration structure.
static can_filter_config_t can_filter_cfg;

Field Documentation

◆ can_filter_id_low

uint16_t can_filter_config_t::can_filter_id_low

16-bit Filter ID.

◆ can_filter_id_high

uint16_t can_filter_config_t::can_filter_id_high

16-bit Filter ID.

◆ can_filter_id

uint32_t can_filter_config_t::can_filter_id

32-bit Filter ID.

◆ can_filter_mask_id_low

uint16_t can_filter_config_t::can_filter_mask_id_low

16-bit Filter ID or Filter Mask.

◆ can_filter_mask_id_high

uint16_t can_filter_config_t::can_filter_mask_id_high

16-bit Filter ID or Filter Mask.

◆ can_filter_mask_id

uint32_t can_filter_config_t::can_filter_mask_id

32-bit Filter ID or Filter Mask.

◆ can_filter_bank

uint8_t can_filter_config_t::can_filter_bank

Filter bank.

◆ can_filter_frame_type

can_frame_type_t can_filter_config_t::can_filter_frame_type[4]

Type of frame, data or remote.

◆ can_filter_enable

can_filter_activation_t can_filter_config_t::can_filter_enable

Filter activation status.

◆ can_filter_mode

can_filter_mode_t can_filter_config_t::can_filter_mode

Filter mode.

◆ can_filter_scale

can_filter_scale_t can_filter_config_t::can_filter_scale

Filter scale.

◆ can_filter_fifo

can_filter_fifo_t can_filter_config_t::can_filter_fifo

Filter-to-FIFO mapping.

can_filter_config_t
CAN filter init configuration structure.
Definition: drv_can.h:270