CAN_MSG_OBJ field descriptions

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CAN_MSG_OBJ field descriptions

1,488 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by manishd on Wed Oct 05 18:28:00 MST 2011
Can anyone point me to documentation on the correct use of the mode_id field and particularly the mask field in the CAN_MSG_OBJ structure?

Perhaps their use is self evident to many of you, but, unfortunately not so clear to me.

typedef struct _CAN_MSG_OBJ {
  uint32_t  mode_id;
  uint32_t  mask;
  uint8_t   data[8];
  uint8_t   dlc;
  uint8_t   msgobj;
}CAN_MSG_OBJ

Thanks
0 项奖励
回复
3 回复数

1,387 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by deepak.thota88 on Thu Apr 09 07:03:07 MST 2015
ok and in e.g.

I just want to catch

100 , 101 , 200 , 201  speratly is the mask still 0x7FF?


BR
0 项奖励
回复

1,387 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by madid87 on Thu Oct 06 04:48:07 MST 2011

Quote: manishd
Can anyone point me to documentation on the correct use of the mode_id field and particularly the mask field in the CAN_MSG_OBJ structure?

Perhaps their use is self evident to many of you, but, unfortunately not so clear to me.

typedef struct _CAN_MSG_OBJ {
  uint32_t  mode_id;
  uint32_t  mask;
  uint8_t   data[8];
  uint8_t   dlc;
  uint8_t   msgobj;
}CAN_MSG_OBJ

Thanks



Hi.
Fields "mode_id" and "mask" are used for acceptance filtering, i.e. CAN controller will receive only IDs that you specify.

Example:
mode_id = 0x020
mask = 0x7FF
This mask has all bits (in case of 11 bit ID) as ones. This means that the filter will compare all bits with the mode_id. So only ID=0x020 will be accepted.

If mask is for example 0x7F0 the filter will compare only upper bits, so IDs ranging from 0x020 to 0x02F (filter doesn't care for lower nibble) will be accepted.

In other words the filter will logical AND input message ID with the mask and the result will be compared to mode_id. If equal, the message is accepted.

Cheers.
0 项奖励
回复

1,387 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Oct 06 04:43:32 MST 2011
Isn't that answered here:

http://knowledgebase.nxp.com/showthread.php?t=1765
0 项奖励
回复