MCP2515 successfully initialized with odroid-N2 running Linux odroid 4.9.277-122 but I can't send and recieve messages

Post Reply
embed
Posts: 2
Joined: Fri Apr 22, 2022 5:44 pm
languages_spoken: english
ODROIDs: HARdKERNEL
Has thanked: 1 time
Been thanked: 0
Contact:

MCP2515 successfully initialized with odroid-N2 running Linux odroid 4.9.277-122 but I can't send and recieve messages

Post by embed »

I want to use the MCP2515 module with Odroid N2, I refer to this link
https://wiki.odroid.com/common/applicat ... io/can-bus
I wired the Odroid and the mcp2515 module as shown in the link, it is correctly configured as expected in the documentation.


root@odroid:~# apt update && apt full-upgrade

I added the can0 on the device tree overlay section in the file /media/boot/config.ini
overlays="spi0 i2c0 i2c1 uart0 can0"

root@odroid:~# dmesg | grep spi
[ 5.436561] meson-spicc ffd13000.spi: registered master spi0
[ 5.437526] spi spi0.1: setup mode 0, 8 bits/w, 10000000 Hz max --> 0
[ 5.437618] meson-spicc ffd13000.spi: registered child spi0.1
[ 5.437632] spi spi0.0: setup mode 0, 8 bits/w, 100000000 Hz max --> 0
[ 5.437686] meson-spicc ffd13000.spi: registered child spi0.0
[ 7.622769] mcp251x spi0.1: setup mode 0, 8 bits/w, 10000000 Hz max --> 0
[ 7.643501] mcp251x spi0.1 can0: MCP2515 successfully initialized.

root@odroid:~# lsmod | grep spi
spidev 20480 0
spi_meson_spicc 20480 0

root@odroid:~# lsmod | grep mcp251x
mcp251x 24576 0
can_dev 24576 1 mcp251x

root@odroid:~# ls /sys/class/net/
can0 eth0 lo wlan0

root@odroid:~# ifconfig can0
can0: flags=128<NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@odroid:~# ip link set can0 type can bitrate 125000 triple-sampling on
root@odroid:~# ifconfig can0 up
root@odroid:~# ifconfig
can0: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


root@odroid:~# sudo apt install can-utils
root@odroid:~# ifconfig can0 down
root@odroid:~# ip link set can0 type can bitrate 125000 loopback on
root@odroid:~# ifconfig can0 up
root@odroid:~# ip -details link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc fq_codel state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can <LOOPBACK,TRIPLE-SAMPLING> state ERROR-ACTIVE restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535


At this step when I tested the CAN bus in loopback mode, I opened two terminals, in the first I sent Can message "cansend can0 500#11.22.33 "and in the second I read "candump can0" , but I did not find the expected result

Please help me with what to do?
Last edited by embed on Fri Apr 22, 2022 7:46 pm, edited 1 time in total.

User avatar
odroid
Site Admin
Posts: 39117
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2513 times
Been thanked: 1382 times
Contact:

Re: MCP2515 successfully initialized with odroid-N2 running Linux odroid 4.9.277-122 but can bus does not work

Post by odroid »

Do you have an oscilloscope and/or DMM to check power rails and interface connections?
These users thanked the author odroid for the post:
embed (Sat Apr 23, 2022 12:10 am)

embed
Posts: 2
Joined: Fri Apr 22, 2022 5:44 pm
languages_spoken: english
ODROIDs: HARdKERNEL
Has thanked: 1 time
Been thanked: 0
Contact:

Re: MCP2515 successfully initialized with odroid-N2 running Linux odroid 4.9.277-122 but I can't send and recieve messa

Post by embed »

No, I don't have

User avatar
odroid
Site Admin
Posts: 39117
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2513 times
Been thanked: 1382 times
Contact:

Re: MCP2515 successfully initialized with odroid-N2 running Linux odroid 4.9.277-122 but I can't send and recieve messa

Post by odroid »

Your software configuration looks fine.
Therefore, I think there could be a hardware interface problem. Check the wiring connections carefully.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 3 guests