Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Raspberry Pi 5 #528

Open
Puetz opened this issue Nov 4, 2023 · 166 comments
Open

Support for Raspberry Pi 5 #528

Puetz opened this issue Nov 4, 2023 · 166 comments
Assignees

Comments

@Puetz
Copy link

Puetz commented Nov 4, 2023

Hi,

I just got a Raspberry Pi 5 and am getting an error that my hardware revision is not supported.

Here is some hardware information from cat /proc/cpuinfo:

Hardware	: BCM2835
Revision	: c04170
Model		: Raspberry Pi 5 Model B Rev 1.0

I also ran this coding to get paddr=10, baddr=C0000000.

I hope someone can use this information to add a new hardware type and support for the Raspberry Pie 5 🙂
I unfortunately don't know C and have no clue about hardware, so I can't create a PR myself.

Best regards,
Thomas

@Gadgetoid
Copy link
Collaborator

The Pi 5 has significant hardware changes that might make some of this library difficult or impossible to migrate. I’m not qualified to know exactly how bad it is, but the changes are significant enough that a straight hardware ID addition isn’t going to cut it. We need one of the wizards involved in writing or extending the core functionality of rp_ws281x to step in and give us the lowdown.

I’ve talked to folks at Pi about creating a PIO-backed WS281X library for RP1, but there’s no telling when it if that - or the tools to make it happen - will materialise.

@jgarff
Copy link
Owner

jgarff commented Nov 4, 2023 via email

@Gadgetoid
Copy link
Collaborator

I've definitely been wanting to add support for that, if possible.

Wow, of all the things I expected- it wasn't the big guns! I hope you're well.

Unfortunately, I don't yet have a RPi 5 to actually work on.

That's something I can probably fix if you want to give support a shot!

@jgarff
Copy link
Owner

jgarff commented Nov 6, 2023 via email

@zytegalaxy
Copy link

@jgarff If you are in Us/Canada, I can send you a RPi5 to support the port and any other way I can support this. I am getting a similar issue:

raise RuntimeError(
RuntimeError: ws2811_init failed with code -3 (Hardware revision is not supported)

@ebraraktas
Copy link

Hi @jgarff , I tried to add HW spec and debug the library (with main.c after some modification for my led strip). I added the spec below:

    //
    // Raspberry Pi 5
    //
    {
        .hwver = 0xc04170,
        .type = RPI_HWVER_TYPE_PI5,
        .periph_base = PERIPH_BASE_RPI4,
        .videocore_base = VIDEOCORE_BASE_RPI2,
        .desc = "Pi 5 Model B - 4GB 1.0"
    },

where RPI_HWVER_TYPE_PI5 is defined as 4. And it failed to allocate memory in the lines below:

rpi_ws281x/ws2811.c

Lines 939 to 940 in 1f47b59

device->mbox.mem_ref = mem_alloc(device->mbox.handle, device->mbox.size, PAGE_SIZE,
rpi_hw->videocore_base == 0x40000000 ? 0xC : 0x4);

here is the dmesg output for that request:

[ 1884.471030] raspberrypi-firmware soc:firmware: Request 0x0003000c returned status 0x80000001

And ioctl errno corresponds to Invalid argument.

I know nothing about RPi (this is my first device) and mailboxes etc. but I tried to run a simpler code (info.c) in this library to identify the issue, and here is the output (I added Cannot get ... logs after failure):

root@raspberrypi:/home/ebraraktas/Projects/mailbox# ./build/test/info 
Firmware revision: Oct 18 2023 17:30:17
/home/ebraraktas/Projects/mailbox/src/fd.c:52:mailbox_property: error: ioctl: IOCTL_MBOX_PROPERTY: Invalid argument
Cannot get board model
/home/ebraraktas/Projects/mailbox/src/fd.c:52:mailbox_property: error: ioctl: IOCTL_MBOX_PROPERTY: Invalid argument
Cannot get board revision
/home/ebraraktas/Projects/mailbox/src/fd.c:52:mailbox_property: error: ioctl: IOCTL_MBOX_PROPERTY: Invalid argument
Cannot get mac address
Board serial: 0xc77d11596528bd61
ARM memory: 0x3f800000 bytes at 0x00000000
VC memory:  0x02100000 bytes at 0xfdb00000

And memflag.c(link) failed to allocate memory with the same errno, too.

I don't know if any of these helps to diagnose the issue, but I wanted to post my findings. If this issue seems to be resolved quickly, I would like to help it (but it seems way beyond my knowledge).

@jgarff
Copy link
Owner

jgarff commented Nov 12, 2023 via email

@zytegalaxy
Copy link

Do you mind sending me an email to mehrdad@getubo.com so that I can arrange to have one shipped to you?

@jgarff
Copy link
Owner

jgarff commented Nov 27, 2023

I've now got hardware to play with. Many many thanks to @ubopod for the very generous donation! I've started looking into it, and have found the following so far:

  • Changing the hardware device ID is unfortunately insufficient to add support.
  • Using mailbox messages to allocate DMA coherent memory that we can access from userspace doesn't work apparently. I'm investigating, but this is likely due to API changes when communicating with the Videocore VII firmware (new in the RPi5). I could write a small kernel driver to map this type of memory to userspace, but I'm hoping to not have to do that.
  • The GPIOs now run through the new RPi5 RP1 chipset. Because of this they are not compatible with the previous PWM IP in the Broadcom SoC. Although, the RP1 has a neat IP that we can use instead. I'm looking into using the PIO controller in the RP1 along with DMA. I just need to get a cache free userspace buffer to work from.

I'll keep you guys posted with updates. Please be patient though, as I'm fairly busy, but hoping to work more on this over the holidays.

@jgarff
Copy link
Owner

jgarff commented Dec 2, 2023

Just a quick update.

  • I figured out how to get uncached memory from userspace without using the videocore mechanism. This should actually work for all versions of the raspberry pi with newer kernels, and it's much cleaner, so I'm going to rip out the mailbox interface and replace it globally. Once this is done I'll start on the RP1 DMA/PIO.

@mbevand
Copy link

mbevand commented Dec 5, 2023

I was playing for a few hours with attempting (unsuccessfully) a port to work on the Pi 5.

I can confirm that most of the videocore firmware mailbox interfaces have been ripped out (https://forums.raspberrypi.com/viewtopic.php?t=359477) so definitely you need to drop that whole mechanism.

Another thing is the peripheral base address is now 0x107c000000 (instead of 0xfe000000 as on the Pi 4). I believe the new RP1 DMA/PIO will have to be configured through registers in that space, and because it's a base address over the 32-bit limit, you may need to #define _FILE_OFFSET_BITS 64 so that you can access it through /dev/mem

@jgarff
Copy link
Owner

jgarff commented Dec 5, 2023

Thanks @mbevand for the info. Since the RP1 is connected via PCIe, doesn't the base of the registers land in a PCIe BAR?

Region 0: Memory at 1f00410000 (32-bit, non-prefetchable) [size=16K]
Region 1: Memory at 1f00000000 (32-bit, non-prefetchable) [virtual] [size=4M]
Region 2: Memory at 1f00400000 (32-bit, non-prefetchable) [size=64K]

Are they remapping that somewhere else (0x107c000000?) in the rp1 driver?

@mbevand
Copy link

mbevand commented Dec 5, 2023

It doesn't conflict. Because the mapping goes from 0x107c000000 to 0x1080000000 while the BARs are much higher after 0x1f00000000

Per my understanding the mapping at 0x107c000000 is defined on line 90 here (the 64-bit value is represented as two 32-bit values "0x10 0x7c000000"): https://github.com/raspberrypi/linux/blob/29cc35f986a4e1e8671e68d0e363af636be243a2/arch/arm/boot/dts/bcm2712.dtsi#L90

@jgarff
Copy link
Owner

jgarff commented Dec 5, 2023

I'm not worried about a conflict. What I'm suggesting is that the peripherals that are built into the bcm2712 (dma/pcm/pwm/etc.) are no longer being used on the Pi5.

Instead the GPIOs are now wired to the RP1, not the SoC. The RP1 in turn is available to the SoC over PCIe, with all the registers mapped inside a RP1 BAR. Basically we can't use the peripherals in the 2712 anymore as they aren't wired to the actual pins anymore.

Seeing a schematic would be nice though. :)

@mbevand
Copy link

mbevand commented Dec 5, 2023

Doh! I wasn't thinking straight. You are right, of course. The register region at 0x107c000000 is useless to us. As you say, the RP1 PWM registers should be mapped inside a BAR region...

@jgarff
Copy link
Owner

jgarff commented Dec 5, 2023

No worries. I wish you were right. This would be much easier if the pins were still connected to the SoC IP.

@mbevand
Copy link

mbevand commented Dec 6, 2023

I don't know if that's useful or if you already know it, but the BAR can be accessed through sysfs. I wrote this sample code that shows how to read the FIFO_CTRL register of PWM0 on RP1. On my Pi 5 it prints FIFO_CTRL: 20000 since that's the default value of this register, as per page 39 of https://datasheets.raspberrypi.com/rp1/rp1-peripherals.pdf . The RP1 is always at PCI address 0000:01:00.0, and the BAR region with the register is always resource1 so to access it:

#include <sys/ioctl.h>
#include <sys/mman.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

#define OFFSET_PWM0 0x98000
#define OFFSET_PWM1 0x9c000

#define PWM_GLOBAL_CTRL 0x00
#define PWM_FIFO_CTRL   0x04

uint32_t my_read(void *base, ssize_t count, uint32_t offset)
{   
   assert(count == 4);
   return *(uint32_t *)((uint8_t *)base + offset);
}

int main() {
   const char *fname = "/sys/bus/pci/devices/0000:01:00.0/resource1";
   void *base;
   int fd;
   uint32_t reg;

   if (-1 == (fd = open(fname, O_RDWR | O_SYNC)))
       perror("open"), exit(1);
   // 0x400000 is the size in bytes of the "resource1" sysfs file
   base = mmap(NULL, 0x400000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
   if (base == MAP_FAILED)
       perror("mmap"), exit(1);
   if (-1 == close(fd))
       perror("close"), exit(1);
   reg = my_read(base, 4, OFFSET_PWM0 + PWM_FIFO_CTRL);
   printf("FIFO_CTRL: %x\n", reg);
   return 0;
}

@jgarff
Copy link
Owner

jgarff commented Dec 6, 2023 via email

@O-O-O-84
Copy link

Hey guys, i've got the same issue. is there already a solution? Maybe an update for the RPI_WS281x?

@ikke01
Copy link

ikke01 commented Jan 2, 2024

I've now got hardware to play with. Many many thanks to @ubopod for the very generous donation! I've started looking into it, and have found the following so far:

  • Changing the hardware device ID is unfortunately insufficient to add support.
  • Using mailbox messages to allocate DMA coherent memory that we can access from userspace doesn't work apparently. I'm investigating, but this is likely due to API changes when communicating with the Videocore VII firmware (new in the RPi5). I could write a small kernel driver to map this type of memory to userspace, but I'm hoping to not have to do that.
  • The GPIOs now run through the new RPi5 RP1 chipset. Because of this they are not compatible with the previous PWM IP in the Broadcom SoC. Although, the RP1 has a neat IP that we can use instead. I'm looking into using the PIO controller in the RP1 along with DMA. I just need to get a cache free userspace buffer to work from.

I'll keep you guys posted with updates. Please be patient though, as I'm fairly busy, but hoping to work more on this over the holidays.

Hallo Jeremy, did you make any progress on this for the PI5, we are looking forward to it if you can fix it to get it working again. Thanks Raymond

@jgarff
Copy link
Owner

jgarff commented Jan 2, 2024

Hi Raymond, I was able to work on this some over the holidays. I have some open questions in a developer forum regarding the DMA that I'm hoping can be answered. Unfortunately, the specs available thus far are lacking in specific functionality of the RP1. Some of which are tied up behind non-public specifications for intellectual property from third parties used in the RP1.

@ikke01
Copy link

ikke01 commented Jan 2, 2024 via email

@mehrdadfeller
Copy link

@jgarff Thanks again for the efforts! I hope the necessary information come out soon. If you link to relevant developer forum questions here, we can collectively try to get that information for Raspberry Pi. I have a few contacts in the commercial side and can also ask around to get more attention to it.

@jgarff
Copy link
Owner

jgarff commented Jan 3, 2024

That would be great @mehrdadfeller. The specific questions I have are as follows:

  • Need to get access to the synopsys DMA controller documentation.
  • Need to get the channel mappings for each peripheral (PWM/PIO/etc.) as it relates to the DMA. These are typically used for things like flow control/backpressure/etc. This is how the DMA controller knows that the given channel FIFO is full and whatnot. It's hard to know the specifics without the DMA docs though.
  • There is a linux synopsys DMA driver in the kernel. I've gone through some of the code. I may end up having to write a kernel driver for this though if I want to use the same driver, but still need the mapping info.
  • I'm also curious as to how they are using platform drivers inside a PCIe device, which typically uses a pcie driver. Auto detection and loading kernel modules, or how platform drivers can live in pcie devices from a device tree point of view. I've hacked this before myself on other projects I've done with PCIe connected FPGAs, but curious as to how they are handling the kernel module dependencies and such.

@ikke01
Copy link

ikke01 commented Oct 31, 2024 via email

@Gadgetoid
Copy link
Collaborator

Now only need to figure out how to get then python working😂

😅

@Gadgetoid
Copy link
Collaborator

Gadgetoid commented Nov 4, 2024

With the Python bindings the closest I can get is:

malloc(): invalid size (unsorted)
Aborted

I clearly have some catching up to do!

Edit:

Okay, now I have found and followed the wiki it appears to work for some examples but not others.

Unicorn HAT's "demo.py" has never been so smoooth.

The above error still happens for rainbow.py and for the lowlevel.py shipped with rpi-ws281x-python. Some debugging to do!

Edit - again:

Okay so the malloc() issue is due to the library zero-initing both channels, if I drop that it works for all examples. It's bizarre that it only fails for some, and that it's very consistent about which ones it fails for. The setup is no different between them.

New test release: https://github.com/rpi-ws281x/rpi-ws281x-python/releases/tag/pi5-beta2

@timonsku
Copy link
Contributor

timonsku commented Nov 4, 2024

Great work from everyone on this!
Have you considered submitting the kernel module to the Pi Kernel? I'm sure they would be open to merging that in. Happy to help the process if needed.

@Gadgetoid
Copy link
Collaborator

I'm sure they would be open to merging that in. Happy to help the process if needed.

Worth a try, though I do wonder if this should (or even could?) lean on the RP1 PIO driver when it's ready.

@jgarff
Copy link
Owner

jgarff commented Nov 4, 2024 via email

@timonsku
Copy link
Contributor

timonsku commented Nov 5, 2024

Yea I think both would definitely be useful!
Also who knows when we will actually get PIO exposed officially.

@ikke01
Copy link

ikke01 commented Nov 11, 2024 via email

@ikke01
Copy link

ikke01 commented Nov 11, 2024

root@00000002:/home/rpi_ws281x/rpi-ws281x-python/examples# sudo /home/Display/.venv/bin/python strandtest.py
Traceback (most recent call last):
File "/home/rpi_ws281x/rpi-ws281x-python/examples/strandtest.py", line 97, in
strip.begin()
File "/home/Display/.venv/lib/python3.11/site-packages/rpi_ws281x/rpi_ws281x.py", line 143, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -3 (Hardware revision is not supported)

@ikke01
Copy link

ikke01 commented Nov 11, 2024

Looks like the old version is not updated with new code.

root@00000002:/home/rpi_ws281x/rpi-ws281x-python/examples# sudo /home/Display/.venv/bin/pip show rpi_ws281x
Name: rpi-ws281x
Version: 5.0.0
Summary: Userspace Raspberry Pi PWM/PCM/SPI library for SK6812 and WS281X LEDs.
Home-page: https://github.com/rpi-ws281x/rpi-ws281x-python/
Author: Jeremy Garff jer@jers.net, Phil Howard phil@pimoroni.com
Author-email: jer@jers.net, phil@pimoroni.com
License: MIT
Location: /home/Display/.venv/lib/python3.11/site-packages
Requires:
Required-by:

@Gadgetoid
Copy link
Collaborator

Gadgetoid commented Nov 11, 2024

Needs the Pi 5 branch of the bindings - https://github.com/rpi-ws281x/rpi-ws281x-python/tree/pi5

Don’t forget to git submodule update --init

Prebuilt wheels also available https://github.com/rpi-ws281x/rpi-ws281x-python/releases/tag/v5.0.0

@Tetrikus
Copy link

Thanks to everyone for the efforts to bring the library to the Pi 5! Much appreciated!! 🙏🏼

I tried to follow the discussion here. Did I get that right, that it is currently only possible to use GPIO 18? And if yes, what would I do, if I need Audio at the same time? 🤔 Just not possible right now?

@jgarff
Copy link
Owner

jgarff commented Nov 17, 2024

Please see the wiki. The restriction on pin 18 is fixed. You can use one of pins 12, 13, 14, 15, 18, 19 now.

https://github.com/jgarff/rpi_ws281x/wiki/Raspberry-Pi-5-Support

@Tetrikus
Copy link

Tetrikus commented Nov 17, 2024

Please see the wiki. The restriction on pin 18 is fixed. You can use one of pins 12, 13, 14, 15, 18, 19 now.

Oh, my bad! Thank you so much! Might be a good idea to remove or edit this in the introduction of the wiki page. It confused me. 😇

Currently these instructions are for using GPIO 18. Other pins and more channels will be added to the driver soon.

@anico97as
Copy link

anico97as commented Nov 22, 2024

Hi @jgarff,

thanks for your efforts regarding PI5 suport.
However i noticed some random side effects after performing all the steps you described in your tutorial for PI5 support. After performing following steps:

`

    $ 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

`

The $DISPLAY will be unset and my application will not recognize the attached touchscreen i have on my PI5. Before performing the steps mentioned above the contents of the $DISPLAY variable are as usual :0. After those steps the variable is unset.

Do you maybe have any idea what the issues here could be?

Thank you very much

@timonsku
Copy link
Contributor

PIO support has now also been made public: https://github.com/raspberrypi/utils/blob/master/piolib/examples/ws2812.c

@ragazenta
Copy link

ragazenta commented Dec 10, 2024

I'm extremely interested in getting this into the kernel. I think it's still useful as is, because it would free the PIO to be used for other things at the same time. As soon as I get the other channels working, I'll have the driver ready to submit a PR.

Hi @jgarff, I assume you're preparing concurrent channel PWM support (you updated the wiki 3 weeks ago).

I've tried preparing your kernel driver to be merged to Pi Kernel upstream (*). See: https://github.com/ragazenta/raspi-linux/commits/pwm-ws281x-rp1/

I'm not sure this should go to drivers/pwm or drivers/leds. I prefer the former. I tested it and it works great.

I have several requests, to make the patches series simpler, hopefully you can address:

  • rename rp1_ws281x_pwm.[ch] to pwm-ws281x-rp1.[ch] (constants and variables as well)
  • rename rp1_ws281x_pwm.dts to pwm-ws281x-overlay.dts
  • make pin configurable via dtoverlay param (see pwm or pwm-2chan overlay), it's simple.

PS:
(*) I doubt they will accept the PR as they've already implemented the RP1 PIO driver in the latest kernel.

@valtsu23
Copy link

Hello,
I tried to follow the wiki page installation guide, but I get an error:

userid@raspberrypi:~/rpi_ws281x/rp1_ws281x_pwm $ sudo dtoverlay -d . rp1_ws281x_pwm
Segmentation fault

I upgraded everything with apt before I tried anything.

@bakerlogan
Copy link

Is there any chance of making this work nicely with the OctoPrint plugin WS281x_LED_Status so that root access / building a kernel module isn't required?

@jgarff
Copy link
Owner

jgarff commented Dec 14, 2024

I'm extremely interested in getting this into the kernel. I think it's still useful as is, because it would free the PIO to be used for other things at the same time. As soon as I get the other channels working, I'll have the driver ready to submit a PR.

Hi @jgarff, I assume you're preparing concurrent channel PWM support (you updated the wiki 3 weeks ago).

Yeah. Although I'm hoping to have more time to finish that up over the holidays.

I've tried preparing your kernel driver to be merged to Pi Kernel upstream (*). See: https://github.com/ragazenta/raspi-linux/commits/pwm-ws281x-rp1/

That's great! I'd be happy to merge our changes together to submit it.

I'm not sure this should go to drivers/pwm or drivers/leds. I prefer the former. I tested it and it works great.

Using driver/pwm sounds more appropriate to me actually.

I have several requests, to make the patches series simpler, hopefully you can address:

  • rename rp1_ws281x_pwm.[ch] to pwm-ws281x-rp1.[ch] (constants and variables as well)
  • rename rp1_ws281x_pwm.dts to pwm-ws281x-overlay.dts
  • make pin configurable via dtoverlay param (see pwm or pwm-2chan overlay), it's simple.

Sure, those sound like good changes to me. Thanks!

@jgarff
Copy link
Owner

jgarff commented Dec 14, 2024

Hello, I tried to follow the wiki page installation guide, but I get an error:

userid@raspberrypi:~/rpi_ws281x/rp1_ws281x_pwm $ sudo dtoverlay -d . rp1_ws281x_pwm
Segmentation fault

I upgraded everything with apt before I tried anything.

I'm not sure what might be the problem without more information here. First I assume this is a Pi5, 64-bit OS, etc.? I would be good if you could help describe your exact setup.

@jgarff
Copy link
Owner

jgarff commented Dec 14, 2024

Is there any chance of making this work nicely with the OctoPrint plugin WS281x_LED_Status so that root access / building a kernel module isn't required?

Unfortunately, having root (for non Pi5 systems) is absolutely required to get to the hardware blocks needed. As for running without a kernel module on a Pi5, that's also not possible. A device driver is required.

Having said that, it is possible for you to change the permissions on the device file (on a Pi5 w/kernel module), and then run the userspace application non-root. I haven't tried that, but I think it should work. This could be done using a udev rule or something.

@jgarff
Copy link
Owner

jgarff commented Dec 14, 2024

Hi @jgarff,

thanks for your efforts regarding PI5 suport. However i noticed some random side effects after performing all the steps you described in your tutorial for PI5 support. After performing following steps:

`

    $ 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

`

The $DISPLAY will be unset and my application will not recognize the attached touchscreen i have on my PI5. Before performing the steps mentioned above the contents of the $DISPLAY variable are as usual :0. After those steps the variable is unset.

Do you maybe have any idea what the issues here could be?

Thank you very much

I'm not sure why the DISPLAY variable would change. There is nothing in those commands that I'm aware of that would cause this. I suspect it might be something else in your setup. In any event, it might be worthwhile to save it off before those commands and restore it afterwards if you're having trouble.

@valtsu23
Copy link

Hello, I tried to follow the wiki page installation guide, but I get an error:

userid@raspberrypi:~/rpi_ws281x/rp1_ws281x_pwm $ sudo dtoverlay -d . rp1_ws281x_pwm
Segmentation fault

I upgraded everything with apt before I tried anything.

I'm not sure what might be the problem without more information here. First I assume this is a Pi5, 64-bit OS, etc.? I would be good if you could help describe your exact setup.

Yes Pi5 4Gb with 64bit OS lite. Some changes have been made to the config.txt (few overlays in use, maybe that's the problem). I'll test do those affect.

@valtsu23
Copy link

Hello, I tried to follow the wiki page installation guide, but I get an error:

userid@raspberrypi:~/rpi_ws281x/rp1_ws281x_pwm $ sudo dtoverlay -d . rp1_ws281x_pwm
Segmentation fault

I upgraded everything with apt before I tried anything.

I'm not sure what might be the problem without more information here. First I assume this is a Pi5, 64-bit OS, etc.? I would be good if you could help describe your exact setup.

Yes Pi5 4Gb with 64bit OS lite. Some changes have been made to the config.txt (few overlays in use, maybe that's the problem). I'll test do those affect.

Got it working! Seems like the problem was dtoverlay=pwm on config.txt
I also had to install Cmake. Maybe it wasn't included in the Lite version of the OS.

@totalretribution
Copy link

Just in case its useful Raspberry Pi recently posted information about a official userspace library called pioLib with examples of driving addressable leds among other things.

https://www.raspberrypi.com/news/piolib-a-userspace-library-for-pio-control/

@ragazenta
Copy link

PS: (*) I doubt they will accept the PR as they've already implemented the RP1 PIO driver in the latest kernel.

Raspberry Pi now has official PIO driver for WS2812 LEDs: raspberrypi/linux@d6d83ad

@jgarff
Copy link
Owner

jgarff commented Dec 23, 2024

I understand that there is a PIO driver now. That's great. I still think there are a couple things that I think keep this module still worth while as follows:

  • Backward compatibility to older RPi devices.
  • Being able to use the PIO for other features at the same time as the ws281x PWM.

@totalretribution
Copy link

  • Being able to use the PIO for other features at the same time as the ws281x PWM.

Is this for either the piolib userspace driver or the ws2812 led driver as I did not find any mention of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests