Site Information

 Loading... Please wait...

Blog

Testing PICAN CAN Bus HATs with the Raspberry Pi 5

Posted by Wilfried Voss on

The new Raspberry Pi 5 features the Broadcom BCM2712 quad-core Arm Cortex A76 processor @ 2.4GHz, up to three times faster than the previous generation. With RAM variants up to 8GB, this is the fastest, smoothest Raspberry Pi experience yet.

The latest release of Raspberry Pi OS was made to maximize Raspberry Pi 5's potential. The operating system delivers superb desktop performance, making it ideal for work, leisure, enterprise, and more.

Key features include:

  • 2.4GHz quad-core 64-bit Arm Cortex-A76 CPU
  • VideoCore VII GPU, supporting OpenGL ES 3.1, Vulkan 1.2
  • Dual 4Kp60 HDMI® display output
  • 4Kp60 HEVC decoder
  • Dual-band 802.11ac Wi-Fi®
  • Bluetooth 5.0 / Bluetooth Low Energy (BLE)
  • High-speed microSD card interface with SDR104 mode support
  • 2 × USB 3.0 ports, supporting simultaneous 5Gbps operation
  • 2 × USB 2.0 ports
  • Gigabit Ethernet, with PoE+ support (requires separate PoE+ HAT, coming soon)
  • 2 × 4-lane MIPI camera/display transceivers
  • PCIe 2.0 x1 interface for fast peripherals
  • Raspberry Pi standard 40-pin GPIO header
  • Real-time clock
  • Power button

While we appreciate the increased performance of hardware and software, such an upgrade also causes major headaches for manufacturers and sellers of RPi HATs, such as our  PiCAN CAN Bus HAT series. The questions that arise are:

  1. Is the HAT still hardware-compatible?
  2. Will the driver software and other software utilities still work?

Consequently, I accomplished some tests with an RPi5-8G and our PiCAN Duo CAN Bus HAT with SMPS (Switch Mode Power Supply). I chose the DUO version since it allows me to exchange CAN Bus data frames between two ports.

The installation requires several steps:

  • 1.Add lines to the config.txt file:
    In the command line, type sudo nano /boot/config.txt.
    Add these three lines at the end of the file:
    dtparam=spi=on
    dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
    dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24

    Save the file and reboot: sudo reboot
  • 2.Initialize the CAN ports:
    sudo /sbin/ip link set can0 up type can bitrate 500000
    sudo /sbin/ip link set can1 up type can bitrate 500000
  • 3.Install the CAN utilizes:
    sudo apt-get install can-utils
  • 4.Open two Terminal windows.
    In the first window, enter candump can0.
    In the other window, enter cansend can1 7DF#0201050000000000.

The below image shows a screenshot proving that the data exchange works as expected:

However, there are some restrictions regarding hardware compatibility. You should experience no problems with boards that don't carry an SMPS (Switch Mode Power Supply).

The SMPS versions will also work, but their use may restrict the range of hardware extensions. The RPi5 is ideally powered by a 5 Amp power supply, but the latest SMPS versions supply only 3 Amp. Consequently, at startup, the RPi OS displays a message:

The power supply is not capable of supplying 5A. Power to peripherals will be restricted.

The power supply is not capable of supplying 5A.
Power to peripherals will be restricted.  

My tests ran smoothly at 3 Amps, but it is not guaranteed that operation will continue with additional peripherals (HATs). So, as long as we are waiting for a 5A SMPS version, please take extra caution when testing and operating your application.

The SMPS situation applies specifically to automotive applications when power is supplied through the vehicle's battery. You must also be cautious about using the RPi 5 in automobiles or any battery-supplied application. I consider the 5 Amp almost prohibitive for automotive applications, specifically in terms of preserving battery power. Other embedded solutions, such as the Arduino series, draw much less amperage.

On another note, the above-described test applies to Classical CAN Bus HATs. At this time, I assume that our CAN FD HATs will also work. Please check our website frequently for updates on CAN FD Hats compatibility.


PiCAN2 Duo CAN Bus Board For Raspberry Pi 4 With 3A SMPS

PiCAN2 Duo CAN Bus Board for Raspberry Pi 4 With 3A SMPS

The PiCAN2 DUO board provides two independent CAN Bus ports for the Raspberry Pi 4. It uses the Microchip MCP2515 CAN controller with MCP2551 CAN transceiver. Connections are made via a 4-way screw terminal. This board has a 5VDC 3A SMPS (Switch Mode Power Supply) that can power the Pi and the PICAN board. The board has an easy-to-install SocketCAN driver, which allows programming in C or Python.

More Information...

Extending ESP32 Functionality by Using Raspberry Pi HATs

The ESP32 processor integrates peripherals such as UART, CAN Bus, WIFI, and Bluetooth, allowing a wide range of applications. Its low price adds to its popularity.  Various ESP32 development boards, such as the ESP32-WROOM-32, are available in the market, as shown to the left. However, compared to popular systems like the Raspberry Pi or Arduino, the [...]

Read More »


Installing python-can on the Raspberry Pi

This post demonstrates the steps required to install python-can on the Raspberry Pi for use with PiCAN2, PiCAN3, PiCAN-M CAN Bus HATs. First make sure the driver is installed. See:PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi...Now install python-can: pip3 install python-can Check there is no error. You can now initialize the CAN interface: sudo /sbin/ip link set can0 [...]

Read More »


PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi

This post provides you a brief overview on the steps required to install the software driver on the Raspberry Pi for use with the PiCAN2, PiCAN3, and PiCAN-M CAN Bus HATs, including the dual-port and SMPS versions. Please refer also to the board's user manual. Start by creating a new SD card image with the Raspberry Pi [...]

Read More »


PiCAN FD Functionality Test - CAN Bus FD Duo Board with Real Time Clock for Raspberry Pi

CAN FD (CAN with Flexible Data-Rate) is an updated version of the CAN 2.0B protocol. It takes into account the requirement of the automotive industry to make Classical CAN faster. To achieve that, two principles have been introduced: Faster transfer of the data frame – the Arbitration Field (ID and Acknowledgement) remain unchanged so that the arbitration [...]

Read More »