I am using a CAN Bus shield for a raspberry pi which uses MCP2515. I want to wakeup the connected CAN device, send a message, and put it back to sleep. I am aware there is a sleep mode on CAN transceivers but am not sure if it works the way I intend to implement it.

I am new to CAN bus and electronics so I was looking for some help with this.

Here is the data sheet for the MCP2515: https://seeeddoc.github.io/Open_parts_library/res/310070025.pdf

and the PiCAN2 (RasPi CAN Bus Shield): http://skpang.co.uk/catalog/images/raspberrypi/pi_2/PICAN2DSB.pdf


  • \$\begingroup\$ This: github.com/tdamdouni/Raspberry-Pi-DIY-Projects/blob/master/… and its associated repository has a bit more info on communicating with the shield. \$\endgroup\$ – IronEagle Jul 15 '19 at 19:10
  • \$\begingroup\$ Thanks for the link but I am looking for a way to wake up the can bus through a message from the CAN bus shield and there isn't much information online or in the docs how to do this. There is a sleep/standby pin on the MCP2515 but no information on how to use it. \$\endgroup\$ – Maanit Jul 15 '19 at 20:04
  • \$\begingroup\$ Look for the MCP2515 documentation for the word "sleep". There's info on sending an interrupt bit to wake up the bus. \$\endgroup\$ – IronEagle Jul 15 '19 at 20:08
  • \$\begingroup\$ It's a CAN controller, not a transceiver. Those are two separate circuits, both are needed. A controller is smart and handles the CAN communication, while a transceiver is merely there for the voltage level adaption and to get differential signals. Putting the CAN controller in sleep while at the same time using Rasp Pi is silly - you've already picked a CPU that draws loads of current. If micro-managing current consumption is important, you wouldn't be using Rasp Pi. So I rather suspect you are looking for a way to chip select the controller over SPI, which is something else. \$\endgroup\$ – Lundin Aug 5 '19 at 8:21

First of all, sleep (and standby where supported) modes of CAN transceivers has very little to do with Pi. The MCP2515 is not a transceiver, it is a controller.

Second, you should distinguish between sleep modes of all three (transceiver, controller and Pi) and figure out what is it you really want to do. Not to mention that "connected CAN device" sounds awfully like remote device that you wish to control, not your own.

As for the local Pi + shield, there are several options as well. What you have available to you depends on which MCP2515 pins are available on the shield.

You can:

  • use "int" pin configured for wake up on bus activity to wake up your Pi when there is a any communication on a bus.

  • use "int" pin configured for receive interrupt to wake up your Pi when specific messages received.

  • use SPI commands to put MCP2515 into and out of standby mode. Then the Pi will control when MCP2515 sleeps, while you can program Pi sleep time separately.

  • a combination of the above, depending on your specific requirements.

The configuration registers of MCP2515 responsible for various sleep and wake up modes are thoroughly described in the documentation. The problem you might face, however, is that specific CAN driver available to you on Pi might hide SPI layer and give you only access to CAN messages. I am not familiar with Linux CAN implementations, so can't help you there. AFAIK SocketCAN driver does exactly that.

On the other hand the PiCAN datasheet that you've referenced mentions "Interrupt RX on GPIO25", which might indicate that the driver configures some default behavior on net activity. I can only suggest connecting whatever signal analyzer tool you have available to that pin and trying to figure out what triggers it.


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.