1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

BUG Unable to initialize ws281x library.

Discussion in 'Bug Reports' started by peter, 21 January 2017.

  1. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    Hello, I am trying to compile hyperion on orangepi lite with Armbian, according to
    https://github.com/hyperion-project/hyperion/blob/master/CompileHowto.txt for ws2812b LEDs 3pin (in hyperion config "type" : "ws281x", "colorOrder" : "grb").

    I tried these cmakes:
    Code:
    cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=OFF -DENABLE_X11=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
    cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=ON ..
    cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=ON -DENABLE_WS281XPWM=ON ..
    but none of them worked after, I mean compilation finished successful, but when I run sudo /usr/bin/hyperiond /home/pi/hyperion.config.json it raises Unable to initialize ws281x library. When I added -DENABLE_WS281XPWM=ON it raises:
    whiteAlgorithm ::
    Unable to initialize ws281x library.
    terminate called after throwing an instance of 'int'


    Any idea please?
     
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    1,303
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
  3. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    maybe yes. I am trying to find a way how to compile it for orangepi (3wires LEDs ws2812b).
     
  4. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Correct - pwm uses direct register access so it Pi only.

    Ws2812 over spi should work on other fruits
     
  5. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    @penfold42 thank you. So any advice please which cmake command should I use to compile hyperion? And after that, how to define ws2812b with spi in hyperion config?

    I assume, used gpio pins stay the same as on rpi (one gnd, one for data).

    P.S. when I used all three cmake commands as I described at the top, compilation finished but I was unable to make it working even if I paste spidev0.0 to config file. It raised "Unable to initialize ws281x" error.
     
  6. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    Hi again, I recompiled hyperion with the cmake from CompileHowto.txt and set ws2812spi, connectied gpio to orange pi MOSI.
    Communication with LEDs is working but:
    - i see that generated colors from v4l2 grabber are delayed (and not smooth, looks like as cpu speed issue)
    - when there is no signal (I mean black screen on usb video grabber), some leds stay white
    - initial "rainbow swirl fast" effect just flashes for a while and after that hyperion goes to v4l2 grabber processing.
    - when I stop hyperiond, first LED stays white or green
    - but remote static color/effect change is working properly


    Why this happens? When I run it or RPi with pwm, everything works properly.

    /I tried to post it to the https://hyperion-project.org/threads/ws281x-spi-connection-device-type.82/page-3 but it is Locked/
     
    Last edited: 21 January 2017
  7. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Can you try adding a level shifter ?

    A 74hct125 is the best option but just about any 74HCT series chip can be made to work if you're creative.
     
  8. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    I will try level shifter and report back.
     
  9. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    so with level shifter is behaviour the same.
    - when I start hyperiond via cmd line , it slows down on orangepi after line "INFO: Proto server created and started on port 19445" when starting v4l2 grabber. I found out on rpi this step is very quick. It looks like it is really slowed down on opi, but no idea why (even when color changes on LEDs, it has visible "steps/chopping" when generating colors from grabber)
    It has definitely something to do with usb grabber (slower response with v4l2).
     
    Last edited: 22 January 2017
  10. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    update: when I run hyperiond without grabber and then run hyperion-v4l2, colors are smooth and nice.
     
  11. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Interesting - what does CPU usage look like in the 2 scenarios ?

    The SPI based driver relies on the DMA capability of the kernel - I wonder if the orange pi kernel has issues here
     
  12. peter

    peter Member

    Messages:
    108
    Hardware:
    RPi1/Zero, RPi2, RPi3
    CPU usage is quite interesting, Via "top":
    - With usb grabber directly in v4l2-grabber in json hyperiond: Total CPU 18% (hyperiond 73%)
    - Without usb grabber hyperiond (without v4l2-grabber): Total CPU 0.3% (hyperiond 3.6%)
    - With usb grabber via hyperion-v4l2, (hyperiond runs too without v4l2-grabber in json): Total CPU 20.9% (hyperiond 23%, hyperion-v4l2 71%) - colors in this scenario works nice.

    It means, when hyperiond and hyperion-v4l2 runs in the separate cores, then it works on opi. But when v4l2-grabber runs via hyperiond in one core, performance is worse.
     
    Last edited: 23 January 2017