raspberry-pican-busifconfigsocketcancanutils

can0 listen can-bus but no data appears


I'm trying to read a CAN-BUS on a vehicle with a raspberry (CAN is connected to DB9 connector on the raspberry). The vehicle provides energy to the raspberry also.

Here's my stack:

Protocol CAN "ISO 15765 CAN" by Bosch
CAN-Bus Board PiCAN3
machine : Raspberry pi 4
Driver/Bus Type : socketCAN
Library : CAN utils

I followed these instructions

#added this in /boot/config.txt and reboot
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
#create the can interface on divice can0 with a bitrate at 500 kbps
sudo /sbin/ip link set can0 up type can bitrate 500000
#connect the PiCAN to a CAN-BUS network, and listen to it:
candump can0
#a data stream is supposed to appear here, but nothing happens...

Note1 : When i open an other tab in my terminal and sending a can message with the command :

cansend can0 7DF#0201050000000000

2 lines of data does appear in the tab that listen to can0, like it only shows what i'm sending but not what the vehicle send.

Note2 : here is the result of the command ifconfig for can0 device

#ifconfig (only can0)
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

Does someone knows why i get zero data from the vehicle ?

here's the tutorials that i tried, with all these, the problem stays the same :
1: copperhilltech
2: Open Garage
3: Harrison's Box


Solution

  • After changing the cable, everything started working fine. It was a hardware problem. Thanks everyone.