hyperion-project / hyperion.ng

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

/dev/spidev1.0 not selectable in Webinterface #1110

Closed ChR-iSz closed 3 years ago

ChR-iSz commented 3 years ago

Bug report

Second LED Stripe on Raspberry 4 GPIO /dev/spidev1.0 not selectable from Webinterface

Steps to reproduce

Add dtoverlay=spi1-3cs in /boot/config.txt to enable the seconds SPI Device

What is expected?

In Webinterface: LED Hardware -> Controller Type -> ws2801 -> SPI Path -> /dev/spidev1.0 selectable.

What is actually happening?

In Webinterface: LED Hardware -> Controller Type -> ws2801 -> SPI Path -> Only /dev/spidev0.0, and /dev/spidev0.1 selectable.

System

Raspberry PI 4 -> Hyperion.ng -> Your version: 2.0.0-alpha.7

Lord-Grey commented 3 years ago

Currently, only those two values are selectable. We are currently exploring to have the list generated dynamically, but that is still in the making.

Until then you add the additional GPIOs into the "output"

./libsrc/leddevice/schemas/schema-ws2801.json

and do a Pull request.

Note: You with also extend other devices where GPIO selections are provided.

Arthur-Koo commented 3 years ago

I've tried that on Pi3 with additional line 'core_freq=250' in boot.txt. There is output from GPIO 20, but the light doesn't change.

Lord-Grey commented 3 years ago

And did you check the log output for errors? You might want starting Hyperion in debug mode and share the log output...

ChR-iSz commented 3 years ago

I've tried that on Pi3 with additional line 'core_freq=250' in boot.txt. There is output from GPIO 20, but the light doesn't change.

Output from GPIO 20 (Mosi) and ... ?

Do you use a WS2812(b) Stripe, or WS2801 ?

Do you mean boot.txt or config.txt ?

Arthur-Koo commented 3 years ago

1) 2812B. 2) Add 'core_freq=250' into config.txt to avoid GPU freq issue with SPI which will cause reboot on Pi3. 3) Add dtoverlay=spi1-3cs or spi1-2cs in /boot/config.txt. Add spidev1.0/spidev1.1 option to 2812B SPI. Then the 2812B SPI LED linked to GPIO 20 (Mosi) and assigned to spidev1.0/spidev1.1 can light on, but it does not work properly, just light without effect, and then auto reboot after several seconds. I guess it may be because of UART/BT conflict on Pi3. But I haven't yet debug it for it's not eager to use multiple stripes.

ChR-iSz commented 3 years ago

@Arthur-Koo you know, that you must edit the WS2812 Schema file, and not this from this pull request #1112 here ?

wrong: ./libsrc/leddevice/schemas/schema-ws2801.json

right ./libsrc/leddevice/schemas/schema-ws2812spi.json

And, you must turn off the audio out in config.txt. Comment in this line:

wrong dtparam=audio=on

right # dtparam=audio=on

and turn on the stable clock time: force_turbo=1

penfold42 commented 3 years ago

2812 won’t work on SPI1 - there’s no DMA support and a pitiful TX buffer

Arthur-Koo commented 3 years ago

@Arthur-Koo you know, that you must edit the WS2812 Schema file, and not this from this pull request #1112 here ?

wrong: ./libsrc/leddevice/schemas/schema-ws2801.json

right ./libsrc/leddevice/schemas/schema-ws2812spi.json

And, you must turn off the audio out in config.txt. Comment in this line:

wrong dtparam=audio=on

right # dtparam=audio=on

and turn on the stable clock time: force_turbo=1

Yes. I've updated the WS2812spi Schema file and got the result.

Arthur-Koo commented 3 years ago

2812 won’t work on SPI1 - there’s no DMA support and a pitiful TX buffer

I think that's the reason.

And there may be solutions, right?

penfold42 commented 3 years ago

Use SPI0 or PWM via the rpi_281x or an external arduino

Arthur-Koo commented 3 years ago

Use SPI0 or PWM via the rpi_281x or an external arduino

But from the wiki https://github.com/notro/spi-bcm2708/wiki & https://elinux.org/RPi_SPI I cannot get any information that there's no DMA support for SPI1.

ChR-iSz commented 3 years ago

So, i add a WS2812b on spidev1.0 (Mosi only) on RPI 4 and only green and blue light works. Red not. I tested with the hyperion NG RGB assist on top right toolbar.

Red is showing white (strange). Possible i must rebuild with spidev1.3 🤷‍♂️

ChR-iSz commented 3 years ago

@Arthur-Koo

Which rate you use in hyperion ng ws2812spi config ?

2857143 ?

penfold42 commented 3 years ago

Use SPI0 or PWM via the rpi_281x or an external arduino

But from the wiki https://github.com/notro/spi-bcm2708/wiki & https://elinux.org/RPi_SPI I cannot get any information that there's no DMA support for SPI1.

This came up here: https://github.com/jgarff/rpi_ws281x/pull/400 It’s covered in the many 100s page long Broadcom documentation

You only need DMA for WS2812 LEDs WS2801 should be ok without DMA.

Arthur-Koo commented 3 years ago

@Arthur-Koo

Which rate you use in hyperion ng ws2812spi config ?

2857143 ?

from 3000000 to 4000000

Arthur-Koo commented 3 years ago

Use SPI0 or PWM via the rpi_281x or an external arduino

But from the wiki https://github.com/notro/spi-bcm2708/wiki & https://elinux.org/RPi_SPI I cannot get any information that there's no DMA support for SPI1.

This came up here: jgarff/rpi_ws281x#400 It’s covered in the many 100s page long Broadcom documentation

You only need DMA for WS2812 LEDs WS2801 should be ok without DMA.

I've found that sentence for UART, and the line for SPI is "Again the SPIs themselves have no throughput limitations in fact they can run with an SPI clock of 125 MHz. But doing so requires significant CPU involvement as they have shallow FIFOs and no DMA support."

penfold42 commented 3 years ago

That’s the section.

Can we close this issue now ?

Arthur-Koo commented 3 years ago

That’s the section.

Can we close this issue now ?

I think so, thanks!

Alootje commented 3 years ago

Not sure if this is the correct section to post my question, if not, please let me know. Short question: is the quoted section also apllicable to APA102 LEDs connected to an RPi?

@Arthur-Koo you know, that you must edit the WS2812 Schema file, and not this from this pull request #1112 here ?

wrong: ./libsrc/leddevice/schemas/schema-ws2801.json

right ./libsrc/leddevice/schemas/schema-ws2812spi.json

And, you must turn off the audio out in config.txt. Comment in this line:

wrong dtparam=audio=on

right # dtparam=audio=on

and turn on the stable clock time: force_turbo=1

Background info: Recently my RPi 3B passed away. On this Pi I had OSMC and Hyperion (not NG) running with two separate LED strings. One String behind the TV and one string attached to a secondary light beside the TV (movie of it in action: https://youtu.be/hfg9NIfXejQ). When no media is playing this secondary light also acts as a regular-ish light bulb.

To enable this from one RPi I enabled /dev/spidev1.0 by adding dtoverlay=spi1-3cs to the config.txt. I'm experimenting with Hyperion NG on a RPi B+ (arm v6) and in the latest version of Hyperion NG only /dev/spidev0.0 and 0.1 are available. I noticed this PR: https://github.com/hyperion-project/hyperion.ng/pull/1112. Does this mean that this will be added to the next release of Hyperion NG?