chitnismahesh31
Posts: 2
Joined: Tue May 11, 2021 5:45 am

[SOLVED] Not able to setup can0.

Tue May 11, 2021 12:28 pm

Hi,

While trying to interface can module with raspberry pi, not able to setup can0. Following are some points that might help.

1. pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux

2. Lines added to /boot/config.txt
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25

3. pi@raspberrypi:~ $ dmesg | grep -i mcp
[ 10.330173] mcp251x spi0.0: MCP251x didn't enter in conf mode after reset
[ 10.330260] mcp251x spi0.0: Probe failed, err=110
[ 10.330355] mcp251x: probe of spi0.0 failed with error -110

4. pi@raspberrypi:~ $ sudo vcdbg log msg
001823.677: dtparam: spi=on
001826.524: dtdebug: found override spi
001826.562: dtdebug: override spi: string target 'status'
001831.745: brfs: File read: 1848 bytes
001839.357: dtdebug: Opened overlay file 'overlays/mcp2515-can0.dtbo'
001841.458: brfs: File read: /mfs/sd/overlays/mcp2515-can0.dtbo
001853.245: Loaded overlay 'mcp2515-can0'
001853.264: dtparam: oscillator=8000000
001853.516: dtdebug: found override oscillator
001853.569: dtdebug: override oscillator: cell target clock-frequency @ offset 0 (size 4)
001854.037: dtparam: interrupt=25
001854.300: dtdebug: found override interrupt
001854.347: dtdebug: override interrupt: cell target brcm,pins @ offset 0 (size 4)
001854.698: dtdebug: override interrupt: cell target interrupts @ offset 0 (size 4)

Kindly help with this.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3876
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Not able to setup can0.

Tue May 11, 2021 2:43 pm

It's likely to be a hardware/wiring problem. The driver sends a reset command, then polls the status register waiting for it to enter "CONF" mode. The error message ("MCP251x didn't enter in conf mode after reset") explains that it didn't get there, and error number -110 means a timeout occurred. You would get the same error without the hardware being present.

chitnismahesh31
Posts: 2
Joined: Tue May 11, 2021 5:45 am

Re: Not able to setup can0.

Wed May 12, 2021 5:07 am

@PhilE It was a hardware issue. 3 jumper wires didn't show continuity end to end. Never doubted new jumper wires to have continuity issue.
Thanks a lot for pin-pointing the issue to me.
Here's the output after recification: -

pi@raspberrypi:~ $ dmesg | grep -i mcp
[ 9.277096] mcp251x spi0.0 can0: MCP2515 successfully initialized.
pi@raspberrypi:~ $ sudo ip link set can0 up type can bitrate 250000
pi@raspberrypi:~ $ candump any
can0 0C54F0AA [8] 32 32 23 24 23 21 21 22
can0 0C54F0AA [8] 32 32 23 24 23 21 21 22
can0 0C54F0AA [8] 32 32 23 24 23 21 21 22

Issue is solved.

Return to “Device Tree”