2

I have been developing an expansion board for my RPi Zero, which contains a power supply based on the buck converter TPS62130 (5V/3A) by Texas Instruments, a USB Hub and a CAN Controller/Transceiver MCP25625.

The controller/transceiver is being fed with two voltage leves, 5V from the buck converter to the transceiver and 3.3V from a voltage regulator LM1117-3.3v to the controller. I used a voltage regulator because the 3.3V output from the RPi Zero would not be able to supply the necessary current.

The MCP25625 is basically the MCP2515 controller and the MCP2551 transceiver in the same chip.

Since MCP25625 has the same "register structure" that the MCP2515, I've been trying to use some tutorials for MCP2515.

I am using Raspian with kernel version 4.9

I have modified /boot/config.txt to include:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=spi-bcm2835

But every time I use sudo ip link set can0 up type can bitrate 250000

All I get is Cannot find device "can0" !! Every single time!

When I run dmesg I get:

    mcp251x spi0.0: Cannot initialize MCP2515. Wrong wiring?
    mcp251x spi0.0: Probe failed, err=19

The board is a PCB and everything is soldered just fine, but perhaps I've made some silly mistake in my circuit. Or maybe I'm forgetting some middle step.

I am attaching part of my schematics in the hopes someone will find my mistake.

Board schematics

Is it really possible to simply change the MCP2515 for the MCP25625?

Have I made some silly mistake in the circuit?

  • Questions about electronic circuit design are off topic here. What makes you think the Pi 3.3V cannot supply enough current? How much do you need? It is hard to see how a 800mA regulator is going to improve things. – Milliways Oct 11 '17 at 1:46
  • Sorry for misplacing the post. There are more things tied to the Pi 3.3V, and I read somewhere that the max draw current is 50mA. Perhaps the regulator is a bit overkill, but it allows me to add more to the board in the future. If you have any useful software related input I'd be grateful. – eduardoSP Oct 11 '17 at 12:35
  • This is one of the most persistent urban myths. All current Raspberry Pi have a switch mode regulator, (far better than the circuit you show) capable of supplying up to 800mA. – Milliways Oct 12 '17 at 0:00
2

We're using the CAN board from SK-Pang and it wouldn't work on the newer RPi v3 B+ model. dmesg logs gave us the same error message as you.

Turns out they've increased the frequency of the SPI onboard bus which is too fast for the CAN board. Simply decreasing the max SPI frequency solved the issue for us.

Edit /boot/config.txt and alter the overlay configuration to add spimaxfrequency=500000, like this:

dtparam=spi=on
dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25,spimaxfrequency=500000
dtoverlay=spi-bcm2835-overlay

Source: I did not discover this, big thanks to chmdebeer in this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=190868

1

I had the same issue. I used the following lines in /boot/config.txt

# CAN shield settings from manual
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835

Notice how yours and mind oscillator and interrupt values are different. Once done reboot your RPi.

Then sudo ip link set can0 up type can bitrate 500000 and hopefull that should do the job.

ifconfig should yeild a similar result to this:

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
  • with newer kernels, dtoverlay=spi-bcm2835 may not be needed. Check ls /boot/overlays/ if it exists. If not, it may already be included in the kernel. – TamusJRoyce Mar 10 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.