Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4591

Interfacing (DSI, CSI, I2C, etc.) • MCP2515 Module with Raspberry zero 2W

$
0
0
Hallo all,

please help me set up the connection of a standard MCP2515+TJA1050 module with 8MHz to a Raspberry Pi Zero 2W.
In the module, I modified the power circuit by supplying 3.3V to the MCP2515 through an AMS1117. The TJA1050 is powered by 5V.

Operating system:

Code:

Linux techtool 6.6.69-v8+ #1835 SMP PREEMPT Thu Jan  2 11:27:29 GMT 2025 aarch64 GNU/Linux

The pin connections are as follows:
# MCP INT --> RPi 22 (GPIO 25); MCP SI --> RPi 19 (GPIO 10); MCP SO --> RPi 21 (GPIO 9)
# MCP SCK --> RPi 23 (GPIO 11); MCP CS --> RPi 24 (GPIO 8)

Code:

#cat /boot/firmware/config.txtgpio=8=op,dhdtparam=spi=ondtoverlay=spi-bcm2835-overlaydtoverlay=spi0-1cs,cs0_pin=8dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25#dtoverlay=mcp2515-can0,spi0-0,oscillator=8000000,interrupt=25,bitrate=10000#dtoverlay=spi-bcm2835-overlaydtoverlay=dwc2
After startup, the following errors are displayed:

Code:

#dmesg -l err[    8.188090] mcp251x spi0.0 can0: bit-timing not yet defined[    8.188118] mcp251x spi0.0: unable to set initial baudrate!

Code:

# sudo ip -details link show can04: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10    link/can  promiscuity 0  allmulti 0 minmtu 0 maxmtu 0    can state STOPPED restart-ms 0          mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp_inc 1          clock 4000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 parentbus spi parentdev spi0.0  sudo ip link set can0 up type can bitrate 250000root@techtool:/home/technik# sudo ip -details link show can04: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10    link/can  promiscuity 0  allmulti 0 minmtu 0 maxmtu 0    can state ERROR-PASSIVE restart-ms 0          bitrate 250000 sample-point 0.875          tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1 brp 1          mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp_inc 1          clock 4000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 parentbus spi parentdev spi0.0
Then the network interface remains inactive and always shows an error.
As a dialog generator, I am using a project on Arduino with another module.
https://github.com/autowp/arduino-mcp2515/tree/master
The modules are connected to each other via CAN_L, CAN_H, and GND lines.
I tried enabling the terminator on only one module and on both—nothing changed. I also tried using different baud rates, but that didn't help either.

What am I doing wrong, or what is not working?
How can I properly test and identify where the error lies?

Statistics: Posted by svd71 — Mon Jan 06, 2025 1:20 pm — Replies 5 — Views 36



Viewing all articles
Browse latest Browse all 4591

Trending Articles