Uncategorized

CAN Bus problem discussion notes

Asked 
Viewed 12 times
1

I’m using PI4 OS Buster.

I want to connect 2 canbus interfaces so I will be able to read both of them at the same time.

this is the connections I have made

    GPIO                CAN
HEADR   SIGNAL     MODULE
PIN      NAME  --- SIGNAL
#02       5V --- VCC
#06        GND --- GND
#38       MOSI --- SI
#35       MISO --- SO
#40       SCLK --- SCK/CLK
#26   SPI0.CE1 --- CS
#36     GPIO16 --- INT


GPIO                CAN
HEADR   SIGNAL     MODULE
PIN      NAME  --- SIGNAL
#02       5V --- VCC
#06        GND --- GND
#19       MOSI --- SI
#21       MISO --- SO
#23       SCLK --- SCK/CLK
#24   SPI0.CE0 --- CS
#32     GPIO12 --- INT

and this the setting in the /boot/config.txt

dtparam=spi=on
dtoverlay=spi1-2cs
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=mcp2515-can1,oscillator=8000000,interrupt=16
dtoverlay=spi-bcm2835-overlay

in this setting this I can only see and work with can0

 pi@raspberrypi:~ $ ls /sys/bus/spi/devices/spi*
/sys/bus/spi/devices/spi0.0:
driver  modalias  net  of_node  power  statistics  subsystem  uevent
/sys/bus/spi/devices/spi0.1:
modalias  of_node  power  statistics  subsystem  uevent
/sys/bus/spi/devices/spi1.0:
driver  modalias  of_node  power  spidev  statistics  subsystem  uevent
/sys/bus/spi/devices/spi1.1:
driver  modalias  of_node  power  spidev  statistics  subsystem  uevent

ip link set 
can0   eth0   lo     wlan0 

I can see the device connected to spi0 and it’s working I have also look here

https://copperhilltech.com/content/PICAN2DUOUGB.pdf

and it’s seem they didn’t do any special setting

Someone know what is wrong? and what am I missing ?

Thanks ,

 New contributor
  • 1
    Do you use the PiCan2 HAT whose user guide you link to? If yes, why didn’t you follow the user guide? If no, what HW are you using? – oh.dae.su 4 hours ago
  • Hi @Afik_Android, Welcome and nice to meet you. Ah, let me see. Rpi4B 2GB guy here.I have a couple of CAN modules in my junk bin, collecting dust for more than year. If your CAN board is purple in colour, and marked CJMCU, I can try to find two and reproduce your error scenario. Cheers. (1) AliExpress CAN Bus Module Catalog aliexpress.com/popular/can-bus-module.html. / to continue, … – tlfong01 1 hour ago   
  • This is my CAN sister: (2) AliExpress CJMCU-2551 MCP2551 CAN Bus Module Purple PCB – US$1 fr.aliexpress.com/item/…, Or better still ask your CAN sister show us a selfie. 🙂 – tlfong01 1 hour ago   
  • Your 2016 user guide for Rpi2 is a bit our of date: PiCAN2 Duo User Guide V1.1 (For Rpi2) – SK Pang 2016, copperhilltech.com/content/PICAN2DUOUGB.pdf. Perhaps you can ask SK Pang (1) If they have any up to date driver for Rpi4B buster. (2) Or if there is any old CAN bus driver in the HAT’s EEPROM, and needs to be updated. – tlfong01 43 mins ago   
  • I skimmed your /boot/config.txt and found not problem. The MCP2551 chip is a stupid, non programmable device, doing plain UART/CAN translation and nothing else. So the problem must be the SPI interface. You may like to disconnect the CAN board and do loop back tests for both SPI1 or SPI2. (1) “Using 2 SPIs at the same time – RpiStkEx 2019may”: raspberrypi.stackexchange.com/questions/99079/…, (2) “mcp2551 Datasheet – MicroChip”: sparkfun.com/datasheets/DevTools/Arduino/MCP2551.pdf. – tlfong01 42 secs ago   Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: