天嵌 ARM开发社区

 找回密码
 注册
查看: 8451|回复: 1

TQi.MX6UL开发板CAN测试方法

[复制链接]
freewing 发表于 2021-8-20 09:01:49 | 显示全部楼层 |阅读模式
CAN,全称为“ControllerAreaNetwork”,即控制器局域网,是国际上应用广泛的现场总线之一。CAN可以多主方式工作;也可以分成不同的优先级,满足不同的实时要求;也可以点对点,一点对多点及全局广播几种传送方式接收数据。(感兴趣或进一步了解,点此咨询更多信息

TQi.MX6UL开发板平台有2路CAN接口,具体测试方法如下:

1.配置:
i.MX6UL工控板有2路CAN接口,配置使用ip(route2)工具。注意:busybox里也有集成了ip工具,但busybox里的是阉割版本。不支持can的操作。故使用前请先确定ip命令的版本:
  1. # ip -V
  2. ip utility, iproute2-ss160314
复制代码
以下是配置的命令
  1. ifconfig can0 down
  2. ip link set can0 type can bitrate 100000 triple-sampling on
  3. ip link set can0 up
复制代码
2.接收:
  1. candump can0
复制代码
3.发送:
  1. cansend can0 123#DEADBEEF
复制代码
短接can0与can1的H与L以下是测试过程:
  1. # ifconfig can0 down
  2. # ip link set can0 type can bitrate 1000000 triple-sampling on
  3. # ifconfig can0 up
  4. flexcan 2090000.can can0: writing ctrl=0x012320d4
  5. # ifconfig can1 down
  6. # ip link set can1 type can bitrate 1000000 triple-sampling on
  7. # ifconfig can1 up
  8. flexcan 2094000.can can1: writing ctrl=0x012320d4
  9. # candump can1& #监听can1
  10. # cansend can0 111#1122334455667788 #can0 发送数据
  11. can1 111 [8] 11 22 33 44 55 66 77 88 #can1 接收到的数据
复制代码

qingtianxiayi 发表于 2021-10-13 10:00:31 | 显示全部楼层
测试方法,学习学习学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-3-29 03:29 , Processed in 1.031256 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表