HELP: Need to configure MCP2515 using Raspberry pi's SPI 0 bus.

I am using Raspberry pi 3b+, MCP2515 (CAN Controller), TCAN1042 (CAN Transreceiver) . -------------------------------------------------------------------- uname -a : Linux raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux -------------------------------------------------------------------- sudo dmesg | grep mcp: [ 8.299885] mcp251x spi0.0: MCP251x didn't enter in conf mode after reset [ 8.300217] mcp251x spi0.0: Probe failed, err=110 [ 8.300343] mcp251x: probe of spi0.0 failed with error -110 -------------------------------------------------------------------- I tried modifying /boot/config.txt as below: dtparam=spi=on dtoverlay=mcp2515-can0, oscillator=8000000, interrupt=26 dtoverlay=mcp2515-can0-overlay.dtbo -------------------------------------------------------------------- Also, i tried writing dts and adding its dtbo file in /boot/overlay folder. -------------------------------------------------------------------- Please guide me what I am doing it wrong here.
Solution:
Yes, i updated but that was not the issue. The issue was 2 capacitors connected to external oscillator of MCP2515. Finally, it was hardware issue. Thanks for the help though..!...
Jump to solution
8 Replies
shardul17
shardul17OP6mo ago
dts file: /* * Device tree overlay for mcp251x/can0 on spi0.0 / /dts-v1/; /plugin/; / { compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 { target = <&spi0>; overlay { status = "okay"; }; }; /
the interrupt pin of the can-controller / fragment@1 { target = <&gpio>; overlay { can0_pins: can0_pins { brcm,pins = <26>; / it is the default pin and it will be overriden / brcm,function = <0>; / input / }; }; }; / the clock/oscillator of the can-controller / fragment@2 { target-path = "/clocks"; overlay { / external oscillator of mcp2515 on SPI0.0 / can0_osc: can0_osc { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <8000000>; }; }; }; / the spi config of the can-controller itself binding everything together / fragment@3 { target = <&spi0>; overlay { / needed to avoid dtc warning */ #address-cells = <1>; #size-cells = <0>; can0: mcp2515@0 { reg = <0>; compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <&can0_pins>; spi-max-frequency = <10000000>; interrupt-parent = <&gpio>; interrupts = <26 0x2>; clocks = <&can0_osc>; }; }; }; };
nour_oud
nour_oud6mo ago
@Marvee Amasi Any idea?
Marvee Amasi
Marvee Amasi6mo ago
Hi @shardul17 your kernel version 5.10.103 is prolly around two years ago. I am not saying it is fully the cause of the MCP2515 CAN controller not entering configuration mode on your Raspberry Pi 3b+, but firstly consider updating your Raspberry Pi OS to a newer version. Do the
sudo apt update
sudo apt update
&&
sudo apt upgrade
sudo apt upgrade
Newer kernels often have better driver support Cus your /boot/config.txt configuration is okay So update && upgrade, run it and see if it works
shardul17
shardul17OP6mo ago
Ok. Thank you Any other reasons you can think of??
Marvee Amasi
Marvee Amasi6mo ago
It could be power supply attimes too , does your module receive the correct power voltage ? It's usually 3.3v The dmesg output shows spi0.0 being used, make sure your MCP2515 module is connected to the correct SPI bus mostly usually SPI0 for Raspberry Pi, triple check the wiring based on your module's datasheet But have you updated ? @shardul17
Solution
shardul17
shardul176mo ago
Yes, i updated but that was not the issue. The issue was 2 capacitors connected to external oscillator of MCP2515. Finally, it was hardware issue. Thanks for the help though..!
Marvee Amasi
Marvee Amasi6mo ago
Okay 👍, Happy you were able to get it working
shardul17
shardul17OP6mo ago
Yess..!! Thanks a lot..!
Want results from more Discord servers?
Add your server