AGX与外部设备CAN通信波特率不匹配:需要修改pllaon时钟源
摘要
在使用AGX开发套件与传感器进行CAN通信的时候,发现收不到信息。最后发现是波特率不匹配,传感器的波特率是500k,AGX的波特率始终有误差,需要使用更精确更高速的时钟源。本文将会介绍此问题的现象和解决方法。
AGX的CAN模块配置
创建脚本can_enable.sh,并设置开机自动运行(ubuntu开机自启动)
主要内容
#!/bin/bash
#
# can_enable.sh
sudo busybox devmem 0x0c303000 32 0x0000C400
sudo busybox devmem 0x0c303008 32 0x0000C458
sudo busybox devmem 0x0c303010 32 0x0000C400
sudo busybox devmem 0x0c303018 32 0x0000C458
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on restart-ms 100
sudo ip link set can1 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on restart-ms 100
sudo ip link set up can0
sudo ip link set up can1
sudo ifconfig can0 txqueuelen 1000
sudo ifconfig can1 txqueuelen 1000
硬件连接
AGX的CANx_DIN, CANx_DOUT分别对应Rx和Tx,需要与CAN收发器的Rx和T