Filters:
Comma separated filters can be specified for each given CAN interface:
<can_id>:<can_mask>
(matches when <received_can_id> & mask == can_id & mask)
<can_id>~<can_mask>
(matches when <received_can_id> & mask != can_id & mask)
#<error_mask>
(set error frame filter, see include/linux/can/error.h)
[j|J]
(join the given CAN filters - logical AND semantic)
CAN IDs, masks and data content are given and expected in hexadecimal values.
When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format.
Without any given filter all data frames are received ('0:0' default filter).
Use interface name 'any' to receive from all CAN interfaces.
Examples:
candump -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8
candump -l any,0~0,#FFFFFFFF
(log only error frames but no(!) data frames)
candump -l any,0:0,#FFFFFFFF
(log error frames and also all data frames)
candump vcan2,12345678:DFFFFFFF
(match only for extended CAN ID 12345678)
candump vcan2,123:7FF
(matches CAN ID 123 - including EFF and RTR frames)
candump vcan2,123:C00007FF
(matches CAN ID 123 - only SFF and non-RTR frames)
1、关于 canid 是标准 11位 还是 扩展 29位
例如 candump vcan2,123:C00007FF (matches CAN ID 123 - only SFF and non-RTR frames)
因为 mask 掩码 是 C00007FF 说明 只支持11位(7FF),其他位与的时候都清零了,所以
“only SFF and non-RTR frames” 表示只包括标准帧(Standard Frame Format,SFF)和非远程帧(non-RTR frames)。
再例如 candump vcan2,123:7FF
candump 命令将监听名为 vcan2 的虚拟 CAN 接口,并只捕获 CAN ID 为 123 的消息,包括扩展帧(EFF)和远程帧(RTR)消息。
2、看下 canid 是 扩展29位
candump vcan2,12345678:DFFFFFFF
(match only for extended CAN ID 12345678) 只支持扩展帧,且can id 是 12345678。
3、can 标准帧
标准帧(Standard Frame Format,SFF)
4、can 扩展帧
扩展帧(Extended Frame Format)
5、can 远程帧
远程帧(Remote Frame)
6、can 数据帧
数据帧(Data Frame)
7、数据过滤的公式 是
<can_id>:<can_mask>
(matches when <received_can_id> & mask == can_id & mask)
<can_id>~<can_mask>
(matches when <received_can_id> & mask != can_id & mask)
文章详细解释了如何使用candump命令针对CAN接口进行数据帧过滤,区分标准帧、扩展帧和远程帧,并通过掩码指定接收特定CANID。内容涵盖了CANID的11位和29位格式,以及数据过滤的逻辑操作。
1万+

被折叠的 条评论
为什么被折叠?



