hyperion-project / hyperion.ng

The successor to Hyperion aka Hyperion Next Generation
https://hyperion-project.org/
MIT License
3.02k stars 375 forks source link

PWM ws281x not working #641

Closed TheAndi closed 4 years ago

TheAndi commented 4 years ago

Hi, I was using the "old" Hyperion for years now. Because I was curios about the new NG version and didn't want to wait any longer I compiled it myself on my RPi 1 B+ (running Raspbian Buster Lite, OC 950MHz) with:

wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian-buster

After many hours of compiling I could install it and everything seamed to work. I could reach the WebUI and alter the settings.

But I couldn't get my WS2812b LEDs to work with PWM (tried many combinations of GPIOs and PWM registers).

The log gives me:

[hyperiond LEDDEVICE] (DEBUG) (LedDeviceWS281x.cpp:25:init()) whiteAlgorithm : subtract_minimum [hyperiond LEDDEVICE] (DEBUG) (LedDeviceWS281x.cpp:26:init()) rgbw : 0 [hyperiond LEDDEVICE] (DEBUG) (LedDeviceWS281x.cpp:54:init()) ws281x strip type : 1050624 [hyperiond LEDDEVICE] (ERROR) Dummy device used, because configured device 'ws281x' throws error 'Unable to initialize ws281x library.' [hyperiond LEDDEVICE] (WARNING) latchTime(0) is bigger/equal rewriteTime(0)

So some problem with the ws281x library.

I did blacklist snd_bcm2835 and added

hdmi_force_hotplug=1
hdmi_force_edid_audio=1

I tried the SPI version and did actually work (after increasing the SPI buffer to spidev.bufsiz=32768)

I would have been happy with that, but I get these random flickers every 10s or so. This did never occur on my old setup (Libreelec, RPi 3, old Hyperion, PWM on GPIO18) so I assume my wiring to be fine. Should I open a separate Issue for that? SPI would be better anyway right?

I hope someone can help me, getting my LEDs running again with the NG version. If you need any more Info let me know.

Schon mal vielen Dank und weiter so!

ssirkakriss commented 4 years ago

Hi. Try SPI again with the Pi clocked normal and with "core_freq=250" added to /boot/config.txt.

It may help with the random flickers. Hope it helps.

TheAndi commented 4 years ago

Hi, thanks for the suggestion. Unfortunately it doesn't change the behavior.

One thing I noticed during my tests is that the flicker increased a lot when I run a speedtest on the pi and therefore generating a lot of traffic. It feels to me that some interrupts (e.g. network) screw up the timing of the LED data, resulting in flicker

Is there any way to fix this? I'd like to try PWM too, but this is not working at all.

Thanks again!

ssirkakriss commented 4 years ago

The library that Hyperion uses to drive the ws281x also has info and tips on PWM usage on there git repository. https://github.com/jgarff/rpi_ws281x

It might be helpful. If you not come across it yet.

FPille commented 4 years ago

Running hyperiond as root (via sudo) should solve the problem with the ws281x library.

TheAndi commented 4 years ago

Indeed, root fixed the access to the PWM. Thanks!

To fix it persistent the following commands helped:

sudo systemctl disable --now hyperiond@pi
sudo systemctl enable --now hyperiond@root

I'd like to close the issue, but in my opinion this still is an issue because it does neither work with the default installation nor is there any documentation about it.