Seeed-Studio / seeed-linux-dtoverlays

Device Tree Overlays for Seeed boards
Other
78 stars 55 forks source link

Seeed 2 Channel Shield CAN Bus Error (spi0.0 can0) #15

Closed junh-ki closed 3 years ago

junh-ki commented 3 years ago

Describe the bug I am trying to test Seeed 2 Channel Shield with RPI4. I installed CAN-HAT as follow:

$ git clone https://github.com/Seeed-Studio/seeed-linux-dtoverlays
$ cd seeed-linux-dtoverlays/modules/CAN-HAT
$ sudo ./install.sh 
$ sudo reboot

$ sudo ip link set can0 up type can bitrate 250000
$ sudo ip link set can1 up type can bitrate 250000

As a result, the following messages are produced when trying dmesg | grep spi:

[    4.438050] mcp25xxfd spi1.0 can0: MCP2517FD rev0.0 (-RX_INT +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD m:20.00MHz r:18.50MHz e:0.00MHz) successfully initialized.
[    4.475983] mcp25xxfd spi0.0 can1: MCP2517FD rev0.0 (-RX_INT +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD m:20.00MHz r:18.50MHz e:0.00MHz) successfully initialized.
[    4.532107] mcp25xxfd spi0.1 (unnamed net_device) (uninitialized): Failed to detect MCP25xxFD (osc=0x00000000).
[    6.055171] mcp25xxfd spi0.0 rename4: renamed from can1
[    6.110287] mcp25xxfd spi1.0 can1: renamed from can0
[    6.184771] mcp25xxfd spi0.0 can0: renamed from rename4

can1 works fine as it prints out only a single line of can1 7DF [4] DE AD BE EF on the terminal when trying: cansend can1 7DF#DEADBEEF from a different machine through PEAK-CAN interface.

But when I try the same to can0: cansend can0 7DF#DEADBEEF, the terminal reads the same message repeatedly for infinite times and it never stops until I escape:

...
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
can0  7DF   [4]  DE AD BE EF
...

Eventually, the following messages are shown:

pi@raspberrypi:~ $ dmesg | grep spi
[    4.438050] mcp25xxfd spi1.0 can0: MCP2517FD rev0.0 (-RX_INT +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD m:20.00MHz r:18.50MHz e:0.00MHz) successfully initialized.
[    4.475983] mcp25xxfd spi0.0 can1: MCP2517FD rev0.0 (-RX_INT +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD m:20.00MHz r:18.50MHz e:0.00MHz) successfully initialized.
[    4.532107] mcp25xxfd spi0.1 (unnamed net_device) (uninitialized): Failed to detect MCP25xxFD (osc=0x00000000).
[    6.055171] mcp25xxfd spi0.0 rename4: renamed from can1
[    6.110287] mcp25xxfd spi1.0 can1: renamed from can0
[    6.184771] mcp25xxfd spi0.0 can0: renamed from rename4
[  454.319550] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  480.607262] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  738.291386] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  819.071143] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  821.486984] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  856.825086] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.
[  869.799245] mcp25xxfd spi0.0 can0: RX-0: MAB overflow detected.

I am not sure if this is a HW or CAN-HAT problem. Has anyone experienced the same or something similar?

junh-ki commented 3 years ago

it turned out to be a CAN adapter problem