Blog
Recent Posts
Raspberry Pi PICAN2 Functionality Test With Two PICAN2 HATs
Posted by
onThe following is yet another post on testing the PICAN2 - CAN Bus Interface for the Raspberry Pi, however, with a different approach. In this case, we utilize two identical PICAN2 boards and connect them per the CAN Bus (CAN_H to CAN_H, CAN_L to CAN_L) as shown in the image above.
In the past, we have documented different methods of testing the PICAN2, which did not require the presence of a second PICAN2:
- Troubleshooting your PiCAN2 CAN Interface Board for Raspberry PI...
- PiCAN2 CAN Bus Board for Raspberry Pi - Functionality Test...
- PiCAN2 Duo CAN Bus Board for Raspberry Pi - Functionality Test...
Setting up the config.txt file
The first step is to edit the config.txt file as described in the PICAN User Manual. Please make sure, you use the following settings:
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
I have seen forum entries where users recommended different settings, but they were ultimately wrong.
After editing the file, close it and reboot the Raspberry Pi.
Initializing the CAN Bus Interface
Both PICAN2 boards need to be initialized for using the same CAN Bus baud rate:
sudo /sbin/ip link set can0 up type can bitrate 500000
Sending And Receiving CAN Bus Data Frames
In the following, I used the cansend and candump commands to exchange CAN Bus data frames between the two devices. Yet again, for detailed information on the setup and data transfer, refer to the PICAN User Manual.
The above screen shot shows the content of the monitor to the left. As the first line shows, we transmitted a CAN message, and with the second line, we received data from the other node.
This next screen shot shows the content of the monitor to the right. The CAN data exchange is, of course, in reversed order.
Raspberry Pi Cookbook: Software and Hardware Problems and Solutions
With millions of new users and several new models, the Raspberry Pi ecosystem continues to expand, along with a lot of new questions about the Pi’s capabilities. The second edition of this popular cookbook provides more than 240 hands-on recipes for running this tiny low-cost computer with Linux, programming it with Python, and hooking up sensors, motors, and other hardware—including Arduino and the Internet of Things.
Prolific hacker and author Simon Monk also teaches basic principles to help you use new technologies with Raspberry Pi as its ecosystem continues to develop. This cookbook is ideal for programmers and hobbyists familiar with the Pi through resources, including Getting Started with Raspberry Pi (O’Reilly). Python and other code examples from the book are available on GitHub.
PICAN2 - Raspberry Pi CAN Bus HAT Supports SocketCAN and Python Programming
The PICAN2 board provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. It uses the Microchip MCP2515 CAN controller with MCP2551 CAN transceiver. The CAN Bus connection is via DB9 or 3-way screw terminal. The board is also available with a 5 VDC 1 Amp SMPS (Switch Mode Power Supply) that can power the Raspberry Pi via [...]
OBD-II Data Logging With Raspberry Pi And PiCAN2 CAN Bus Interface
In all regularity, I receive inquiries from users attempting to connect their Raspberry Pi with PiCAN CAN Bus interface to their vehicle's OBD-II diagnostics port, and the questions asked prompted me to write down the essentials to consider for such a project.Please, note: The following refers to reading CAN Bus data from a vehicle's OBD-II [...]
PiCAN2 CAN Bus HAT for Raspberry Pi - Getting Access To The 40-pin GPIO Header
In the past, we had received a number of inquiries regarding the PiCAN2's 40-pin GPIO header, which is designed in a way that it prohibits access to unused GPIOs. Besides the power supply, the PiCAN2 board (one CAN port) itself uses only 6 signals, while the remaining signals cannot be accessed when the board is [...]
Raspberry Pi CPU With CAN Bus Interface Now Upgraded To Raspberry Pi B+
Our Raspberry Pi 3 System With CAN Bus Interface (PiCAN2) has been upgraded to support the new Raspberry Pi B+, and it comes with a pre-installed Raspbian operating system. The system is equipped with either a single or dual PiCAN2 board, and, depending on the selected option, with or without SMPS (Switch Mode Power Supply). The [...]
PiCAN2 CAN Bus Board for Raspberry Pi - Functionality Test
The PiCAN2 board provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. It uses the Microchip MCP2515 CAN Bus controller with MCP2551 CAN Bus transceiver. Connections are made via a 4-way screw terminal or DSUB-9 connector. This board is also available with a 5VDC/1A SMPS (switch mode power supply) that can power both the Pi and [...]
PiCAN2 Duo CAN Bus Board for Raspberry Pi - Functionality Test
The PiCAN2 DUO board provides two independent CAN Bus interfaces for the Raspberry Pi. It uses the Microchip MCP2515 CAN Bus controller with MCP2551 CAN Bus transceiver. Connections are made via a 4-way screw terminal. This board is also available with a 5VDC/1A SMPS (switch mode power supply) that can power both the Pi and the [...]
Monitoring SAE J1939 Data Using The Raspberry Pi Plus PiCAN2 CAN Bus Interface Board
During the past years, we have received multiple inquiries in regards to creating an Electronic Logging Device (ELD) using the Raspberry Pi in combination with our PiCAN2 CAN Bus interface board, where the PiCAN is being used to monitor SAE J1939 data.The mere monitoring of SAE J1939 data (Parameter Group Numbers - PGN) is fairly easy, [...]
Troubleshooting your PiCAN2 CAN Interface Board for Raspberry PI
The PiCAN2 board series we offer through this website provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. And while the hardware has turned out to be exceptionally reliable, we receive requests for technical support on a regular basis. However, the vast majority of these inquiries could be prevented by following some basic steps that prevent [...]
CAN Bus Interface For the Raspberry Pi 2/3 Comes With Various Options
The PiCAN2 board series by Copperhill Technologies provides CAN Bus capabilities for the Raspberry Pi 2 or 3. The boards (with the exception of the dual isolated interface) use the Microchip MCP2515 CAN controller in combination with the MCP2551 CAN transceiver. There is an easy to install SocketCAN driver, and programming can be accomplished in C [...]