jgarff / rpi_ws281x

Userspace Raspberry Pi PWM library for WS281X LEDs
BSD 2-Clause "Simplified" License
1.8k stars 623 forks source link

Can't use PWM on Ubuntu 21.04 #460

Open Mercotui opened 3 years ago

Mercotui commented 3 years ago

I tried using the test application with the default GPIO 18 (PWM0) on my Raspbery Pi 3b, running Ubuntu 21.04. However my LED strip stays off, and this is the console output:

$ sudo ./test -c
Can't open device file
: No such device or address
ws2811_init failed: Failed to create mailbox device

Looking into the code, it seems in mailbox.c the function mbox_open tries to open a device called /dev/vcio. Sadly this doesn't exist on Ubuntu 21.04.

$ ls /dev/vcio
ls: cannot access '/dev/vcio': No such file or directory

The backup mechanism to create a node in /tmp/ also clearly fails, but this is beyond my understanding :shrug:

My fix:

In another issue I saw the recommendation to use SPI, on GPIO 10 instead. Trying that:

$ ./test --gpio 10 -c

The screen lights up in a rainbow, works wonderfully!

Mercotui commented 3 years ago

leaving mostly for prosperity, thank you to the contributors for making this fine library :ok_hand:

transplier commented 2 years ago

Just another headsup. I also ran into the mailbox issue on my B Rev. 2 in Debian 10, but was additionally unable to get SPI working. It appears the SPI driver doesn't load properly, despite configuring it in config.txt. https://github.com/raspberrypi/linux/issues/526

jwillikers commented 2 years ago

/dev/vcio does not exist on Fedora either on the Raspberry Pi CM4.

isidroas commented 4 months ago

Here I am using Raspberry Pi 4 with an image from https://raspi.debian.net/tested-images/

Devices /dev/vcio and /dev/spidev0.0 do not exist.

However I tried WiringPi/examples/pwm.c and it works.

Is there another way to control PWM?