Skip to content

Raspberry Pi 5 Support

Jeremy Garff edited this page Nov 17, 2024 · 20 revisions

Experimental Raspberry Pi 5 Support

Support for the Raspberry Pi 5 is now available. Due to significant changes in the Raspberry Pi hardware, namely the RP1 chipset, a kernel module is now required. Concurrent channel support will be added soon.

There has been significant demand for this feature. I wanted to get something out as soon as I could, so not all features (all channels, inverted signal, etc.) are working yet.

Unfortunately I don't have much time to work through hardware setup issues. It's best to have a working setup on a prior Raspberry Pi model before attempting to use the Pi5. The hardware setup is the same. This will help us focus on Pi 5 specific issues. Thanks.

Lastly, this project relates to electricity and electronic hardware. I take no responsibility for damage to person, property, Pi, LEDs, or anything else. You need to know what you're doing. As always, use at your own risk.

Requirements

  • Rasbperry Pi OS 64-bit
  • Repository pi5 branch
  • Kernel Header Package
  • Device Tree Compiler
  • Device Tree Overlay
  • pinctrl Utility

Installing Required Components

  • Kernel Header Package

    $ sudo apt install linux-headers

  • Device Tree Compiler

    $ sudo apt install device-tree-compiler

  • Pin Control Utility

    $ sudo apt install raspi-utils

Building the Kernel Driver

  • Check out the pi5 branch

    $ git checkout pi5

  • Go into the rp1_ws281x_pwm subdirectory.

    $ cd rp1_ws281x_pwm

  • Build the kernel module.

    $ make

Building the Device Tree Overlay

  • Build the device tree overlay

    $ ./dts.sh

Choosing the correct PWM channel

  • Different pins are able to use different PWM channels in hardware. See the RP1 Datasheet.

  • For convenience the following are the pin and channel settings

    GPIO # pinctrl pwm_channel
    12 a0 0
    13 a0 1
    14 a0 2
    15 a0 3
    18 a3 2
    19 a3 3

Loading the Kernel Driver

  • Loading the kernel module from the driver directory. Use the pwm_channel from the GPIO list above. The following example applies to GPIO 14 and 18.

    $ sudo insmod ./rp1_ws281x_pwm.ko pwm_channel=2

  • Loading the device tree overlay. This will initialize the device.

    $ sudo dtoverlay -d . rp1_ws281x_pwm

  • Setting up the GPIO (for GPIO 18). Use the GPIO number and aX parameter from the list above.

    $ sudo pinctrl set 18 a3 pn

Testing

  • From the base directory, build the library and test program

    $ cmake . ; make

  • Run the test program

    $ sudo ./test