tl_can_echo案例案例功能本案例使用canutils工具包的canecho程序,实现CAN接口数据接收并重发功能。 canutils工具包内含5个独立的程序,分别为canconfig、candump、canecho、cansend、cansequence。 本案例仅使用canecho功能,如需实现其他功能,可自行下载canutils工具包并从中获取对应功能程序源码。 下载链接:https://public.pengutronix.de/software/socket-can/canutils/。程序流程如下图所示。
图 112.3 tl_can_echo 案例2.3.1 案例功能本案例使用 canutils 工具包的canecho 程序,实现 CAN 接口数据接收并重发功能。 canutils 工具包内含 5 个独立的程序, 分别为 canconfig、candump、canecho、cansend、 cansequence 。 本案例仅使用 canecho 功能, 如需实现其他功能, 可自行下载 canutils 工具包并从中获取对应功能程序源码。
特有的实用工具,它可以让 Linux 与车辆上的 CAN 网络进行通信,为了发送、接收和分析 CAN 数据包,需要安装 CAN utils: sudo apt-get install can-utils canutils
/meta-openembedded/meta-networking/recipes-support/bridge-utils/bridge-utils_1.6.bb.do_fetch ERROR: canutils peta/2019.1/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-extended/socketcan/canutils peta/2019.1/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-extended/socketcan/canutils
canutils 主要包括 5 个经常使用的工具: 1、cansniffer 用于嗅探数据包 2、cansend 发送一条数据 3、candump 转储所有接收的数据包 4、canplayer 重播 CAN