Hi.
I’m trying to use CAN bus.
I have attached 2 CAN transceivers
and enabled can0 and can1 with following command.
#check current values of related registers
sudo busybox devmem 0x0c303000
sudo busybox devmem 0x0c303008
sudo busybox devmem 0x0c303010
sudo busybox devmem 0x0c303018
#0x0000C055
#0x0000C055
#0x0000C059
#0x0000C059
#use devmem to modify registers
sudo busybox devmem 0x0c303000 32 0x0000C400
sudo busybox devmem 0x0c303008 32 0x0000C458
sudo busybox devmem 0x0c303010 32 0x0000C400
sudo busybox devmem 0x0c303018 32 0x0000C458
#check modified values of relate registers
sudo busybox devmem 0x0c303000
sudo busybox devmem 0x0c303008
sudo busybox devmem 0x0c303010
sudo busybox devmem 0x0c303018
#0x0000C400
#0x0000C458
#0x0000C400
#0x0000C458
#or use modeprobe to mount CAN controller
sudo modprobe can
sudo modprobe can-raw
sudo modprobe can-dev
sudo modprobe mttcan
#configure CAN controllers with 1Mbps baudrate
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can1 type can bitrate 1000000
#loopback test
sudo ip link set can0 type can bitrate 1000000 loopback on
sudo ip link set can1 type can bitrate 1000000 loopback on
#open CAN controller
sudo ip link set up can0
sudo ip link set up can1
the loopback mode works without problem
after i Test two CAN controllers by connecting CANH to CANH and CANL to CANL of the two controllers
and i change the command with
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can1 type can bitrate 1000000
and for testing i do :
- Open two treminals A and B,run this command in treminal A:
candump can0
- Now the command executed in terminal A should under a listener mode and user inputs are not accepted.Now execute the following command in terminal B and watch what will happen in terminal A.
cansend can1 5A1#1122334455667788
- It supposed to be successful if returned values are these:
can0 5A1 [8] 11 22 33 44 55 66 77 88
But, I am not receiving any messages.
I have already checked all the connections several times, that’s not the problem.
Can you help me please