设为首页收藏本站

Jetson开发者

搜索
查看: 219|回复: 0

如何使用 JETSON TX2上的can?

[复制链接]

120

主题

152

帖子

1949

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1949
发表于 2018-5-16 13:27:48 | 显示全部楼层 |阅读模式
Jetson TX2
Jetson TX2 supports CAN communication among CAN nodes.
TX2 has 2 CAN controllers.
To make use of CAN communications, CAN transceiver has to be interfaced with each of the controllers.
CAN transceiver is the interface between a controller area network (CAN) protocol controller and the physical bus.
To interface transceiver with CAN controller please follow TX2 TRM (CAN topic).
For a quick setup please check the below pin description and the attachment.


J26 PIN === Desc.
1=======CAN wake

3=======CAN0 STAND BY
5=======CAN0 RX
7=======CAN0 TX
9=======CAN0 ERR

13======CAN1 STANDBY
15======CAN1 RX
17======CAN1 TX
19======CAN1 ERR

Once you interface them properly, below steps can be followed to achieve proper communication.

Steps to enable and check CAN on TX2:

1. Enable kernel support for mttcan (Other required modules are already supported)

2. Insert CAN BUS subsystem support module.
modprobe can

3. Insert Raw CAN protocol module (CAN-ID filtering)
modprobe can_raw

4. Real CAN interface support (for our case, it is: mttcan)
modprobe mttcan (dependent module is can_dev: can driver with netlink support)

5. CAN interface settings for both the controllers
ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
ip link set up can0
ip link set can1 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
ip link set up can1

6. Installation of user app to check CAN communication
sudo apt-get install can-utils

7. Commands to run to check CAN packet send/receive
broadcasting a can data packet:
cansend <can_interface> <can_frame>
e.g. cansend can0 123#abcdabcd

Receiving a can data packet:
candump can_interface
e.g. candump can1

Different tools (i.e. cangen, cangw etc) can be used for various filtering options.

8. To check the interface statistics
ip -details -statistics link show can0
ip -details -statistics link show can1
JetsonTX2_CAN.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

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