Skip to content

Latest commit

 

History

History
255 lines (219 loc) · 10.1 KB

install-raspberry-pi5.md

File metadata and controls

255 lines (219 loc) · 10.1 KB

How to Set Up Raspberry Pi 5 and Hailo

In this guide, you will learn how to set up the Raspberry Pi 5 with a Hailo-8/8L AI accelerator.

Table of Contents

What You'll Need

  • Raspberry Pi 5 (8GB recommended)
  • Raspberry Pi 5 AI KIT (option 1)
    • Raspberry Pi M.2 M-Key HAT
    • Hailo-8L M.2 M-Key module (Hailo-8 is also supported)
  • Raspberry Pi 5 AI HAT (option 2)
    • 26TOPs and 13TOPs are supported
  • Active Cooler for the Raspberry Pi 5
  • Optional: Heat sink
  • Optional: An official Raspberry Pi camera (e.g., Camera Module 3 or High-Quality Camera)
  • Optional: USB camera

Hardware

For this guide, we used the Raspberry Pi 5 model along with the official Active Cooler and a 27W USB-C Power Supply. We recommend using the official USB-C power supply to ensure the board can adequately power the M.2 HAT.

Raspberry Pi 5

Raspberry Pi M.2 M-Key HAT

The Raspberry Pi M.2 M-Key HAT can be used with the Hailo-8L M.2 key M or B+M. (Hailo-8 is also supported). When installing the M.2 module, make sure to use the thermal pad to ensure proper heat dissipation between the M.2 module and the HAT. If your project is encapsulated in a case, make sure to have proper ventilation to avoid overheating. If required, add a heat sink to the Hailo-8L module. For detailed instructions on how to install the M.2 module, follow Raspberry Pi's official AI Kit Guide.

Raspberry Pi AI Kit

Raspberry Pi AI HAT

The Raspberry Pi AI HAT is a standalone board that includes the Hailo-8L AI accelerator. It is a plug-and-play solution that can be used with the Raspberry Pi 5. When using the AI HAT, make sure to have proper ventilation to avoid overheating. If required, add a heat sink to the Hailo-8 module. Raspberry Pi's official AI HAT Guide. Raspberry Pi AI HAT

Raspberry Pi Camera

See the Raspberry Pi Camera Guide for instructions on how to install the camera.

Software

Install Raspberry Pi OS

Download and install the latest Raspberry Pi Imager for your OS (Windows, macOS, or Ubuntu) from here.

Select the Raspberry Pi 5.

Raspberry Pi Imager Select Device

Select Raspberry Pi OS (64-bit).

Raspberry Pi Imager Select OS

Update System

Boot up your Raspberry Pi 5 to a graphical environment and update your base software. To do this, open a terminal window and run:

sudo apt update
sudo apt full-upgrade

This will update your system to the latest Raspberry Pi kernel, which includes Hailo driver support. If you get errors from the apt full-upgrade command try running this and retry.

sudo apt --fix-broken install

Set PCIe to Gen3

To achieve optimal performance from the Hailo device, it is necessary to set PCIe to Gen3. While using Gen2 is an option, it will result in lower performance.

Open the Raspberry Pi configuration tool:

sudo raspi-config

Select option "6 Advanced Options", then select option "A8 PCIe Speed". Choose "Yes" to enable PCIe Gen 3 mode. Click "Finish" to exit.

Reboot your Raspberry Pi.
sudo reboot

Install Hailo Software

Install all the necessary software to get the Raspberry Pi AI Kit working. To do this, run the following command from a terminal window:

sudo apt install hailo-all

This will install the following software components:

  • Hailo firmware
  • HailoRT runtime software. See HailoRT GitHub Repo for more information.
  • Hailo TAPPAS Core package: A derivative of the TAPPAS repository, this core package includes GStreamer elements, post-processing functions, and additional tools used by this repository. It is essential for developing applications on the Pi but does not include standalone applications. See Hailo TAPPAS GitHub for more information and documentation.
  • The rpicam-apps Hailo post-processing software demo stages. See Raspberry Pi Official Examples for more information.
Reboot your Raspberry Pi.
sudo reboot

Verify Installation

Now you can check if the Hailo chip is recognized by the system:

hailortcli fw-control identify

If everything is OK, it should output something like this:

Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.17.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB234500128
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP

If you don't see this output, check the PCIe troubleshooting section.

Test TAPPAS Core installation by running the following commands:

Hailotools: (TAPPAS Gstreamer elements)

gst-inspect-1.0 hailotools

expected result:

Plugin Details:
  Name                     hailotools
  Description              hailo tools plugin
  Filename                 /lib/aarch64-linux-gnu/gstreamer-1.0/libgsthailotools.so
  Version                  3.28.2
  License                  unknown
  Source module            gst-hailo-tools
  Binary package           gst-hailo-tools
  Origin URL               https://hailo.ai/

  hailoaggregator: hailoaggregator - Cascading
  hailocounter: hailocounter - postprocessing element
  hailocropper: hailocropper
  hailoexportfile: hailoexportfile - export element
  hailoexportzmq: hailoexportzmq - export element
  hailofilter: hailofilter - postprocessing element
  hailogallery: Hailo gallery element
  hailograytonv12: hailograytonv12 - postprocessing element
  hailoimportzmq: hailoimportzmq - import element
  hailomuxer: Muxer pipeline merging
  hailonv12togray: hailonv12togray - postprocessing element
  hailonvalve: HailoNValve element

Hailonet: (HailoRT inference Gstreamer element)

gst-inspect-1.0 hailo

expected result:

Plugin Details:
  Name                     hailo
  Description              hailo gstreamer plugin
  Filename                 /lib/aarch64-linux-gnu/gstreamer-1.0/libgsthailo.so
  Version                  1.0
  License                  unknown
  Source module            hailo
  Binary package           GStreamer
  Origin URL               http://gstreamer.net/

  hailodevicestats: hailodevicestats element
  hailonet: hailonet element
  synchailonet: sync hailonet element

  3 features:
  +-- 3 elements

If hailo or hailotools are not found, try deleting the GStreamer registry:

rm ~/.cache/gstreamer-1.0/registry.aarch64.bin
If everything is OK you can continue installing the hailo_rpi5_examples.

Upgrade or Downgrade Hailo Software

To upgrade to the latest version of the Hailo software package, run the following commands:

sudo apt update
sudo apt full-upgrade
sudo apt install hailo-all
sudo reboot

Don't forget to update our GitHub repository to the latest version to get the latest examples and resources.

cd [your-path]/hailo-rpi5-examples
git pull

To downgrade to a previous version (TAPPAS 3.28.2), run the following commands:

sudo apt install hailort=4.17.0 hailo-tappas-core-3.28.2 hailofw=4.17.0-2 hailo-dkms=4.17.0-1
sudo reboot

Troubleshooting

Got a question? Join the discussion on Hailo Community Forum.

PCIe Troubleshooting

Make sure the PCIe board and the M.2 module are properly connected. To test if the PCIe board is recognized by the system, run the following command:

lspci | grep Hailo

If you get output like:

0000:01:00.0 Co-processor: Hailo Technologies Ltd. Hailo-8 AI Processor (rev 01)

Then the PCIe board is recognized by the system. If not, check the connection, power supply, and make sure PCIe is enabled (see Raspberry Pi documentation). If the board is new, you may need to update the firmware of the Raspberry Pi 5.

Driver Issue

If you get an error saying the Hailo driver is not installed, make sure your kernel version is greater than 6.6.31. You can get the kernel version by running:

uname -a

If the kernel version is lower than 6.6.31, you may need to run apt update and apt full-upgrade to update the kernel. If your kernel version is OK, reboot the system and try again.

Known Issues

The issues below should be handled by the TAPPAS Core installation deb, but if you encounter them, you can fix them manually.

PCIe Page Size Issue

Some hosts do not support certain PCIe descriptor page sizes. If you get an error like this:

[HailoRT] [error] CHECK_AS_EXPECTED failed - max_desc_page_size given 16384 is bigger than hw max desc page size 4096

Make sure the /etc/modprobe.d/hailo_pci.conf exists and contains the following line:

options hailo_pci force_desc_page_size=4096

Check the configuration:

cat /etc/modprobe.d/hailo_pci.conf
# expected result:
options hailo_pci force_desc_page_size=4096

Cannot Allocate Memory in Static TLS Block

In some scenarios (especially aarch64), you might experience the following error causing some GStreamer plugins to not load correctly. The error message is:


bash
(gst-plugin-scanner:67): GStreamer-WARNING **: 12:20:39.178: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstlibav.so': /lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

This issue should be fixed by adding this to your .bashrc file:

echo 'export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1' >> ~/.bashrc

If you already encountered this error, you can fix it by running the following commands:

export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1
rm ~/.cache/gstreamer-1.0/registry.aarch64.bin