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

Finished Ws281x SPI connection device type

Discussion in 'Development' started by penfold42, 11 May 2016.

Tags:
Thread Status:
Not open for further replies.
  1. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I've been fiddling around with the config quite a bit and I'm currently trying this device but it appears to be doing nothing at all. I should note that I'm running a Pi-1B here.

    Code:
        "device" :
        {
            "name"       : "MyHyperionConfig",
            "type"       : "ws2812spi",
            "colorOrder" : "grb",
            "output"     : "/dev/spidev0.0",
            "rate"       : 3800000
        },
    
    The output when hyperion is and isn't running is currently:
    Code:
    # vcgencmd measure_clock core
    frequency(1)=250000000
    I'm unable to produce any output using SPI at the moment. To be sure the led strip is functioning correctly I have tried the strip on pin 18 using this device which works:
    Code:
     {
         "name"       : "MyHyperionConfig",
         "type"       : "ws2812spi",
         "colorOrder" : "grb"
     },
     
    Last edited: 4 July 2016
  2. Rick164

    Rick164 Administrator Staff Member Administrator

    Messages:
    159
    Hardware:
    RPi2, +Arduino, +AtmoOrb
    Would upload the RPi config.txt to somewhere like gist so @penfold42 can compare it :)
     
  3. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    Oops, forgot about that. It's mostly stock though, with the suggested changes from this topic:
     
    • Like Like x 1
  4. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Interesting - I've never test on openelec.

    I think one of my Pi's has it setup to multi boot so I'll try to replicate it next week.

    Does configuring fewer LEDs work better ? Maybe the OE kernel has SPI issues with more LEDs.

    I am abusing the SPI device a bit - there's an assumption the kernel will use DMA and send all the led data in one continuous burst
     
  5. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I'm actually running Raspbian 8 (Jessie). A stock install specifically for Hyperion a few weeks ago so it shouldn't contain anything out of the ordinary..

    Just for completeness I've tried with 32 leds and I'm not able to get it to do anything anymore unfortunately.

    Could it be that I need a level shifter for it to work through the MOSI pin?
     
  6. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Thanks - I have that too on a spare pi.

    If you're hardware works with a PWM output it should be fine on the MOSI pin
     
  7. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
  8. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    It's difficult to troubleshoot without as oscilloscope - the kernel SPI driver does the heavy lifting and as long as I set the speed right and frame the data right it should just work.

    From memory setting the speed too low would give me white and too high would give me black. I never had a random 1st led.

    Are you sure you're on the right pin for SPI MOSI ?
     
  9. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I'll test with a different header to be sure but I'm fairly certain it's connected properly. I'm using the Adafruit Prototyping Pi shield which makes it quite difficult to pick the wrong connection :)

    https://www.adafruit.com/product/801
    [​IMG]

    Unfortunately I don't have a scope to check... perhaps I should just order one as I've missed it quite often
     
  10. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I'm thinking of buying this little device to check: https://www.saleae.com/

    I've triple checked the wiring so I'm certain that's not the problem. Right now I'm actually thinking the SPI part of my Pi might be fried due to all my messing around.
     
  11. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Just got mine working.

    Fresh raspbian install,
    git clone from Hyperion.ng
    compiled on the pi1 (I forgot how slow they are!)

    i have a 60 led ring attached an the default config with only 46 leds defined.
    Heres my device section of the config.
    "device" :
    {
    "name" : "MyHyperionConfig",
    "type" : "ws2812spi",
    "output" : "/dev/spidev0.0",
    // "rate" : 1000000,
    "colorOrder" : "grb"
    },

    What do you get on the console from hyperiond /etc/hyperion/hyperion.config.json ?
    (well, with _your_ config patch)

    As for the wiring, the Pi and my led strip are powered by the same 50A 5V supply so I only need a single wire from MOSI to the led strip input signal
     
    Last edited: 9 July 2016
    • Informative Informative x 1
  12. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I think I may have simply fried something on this Pi along the way. It's an old one anyhow so I've ordered a new pi to test.

    Code:
    Hyperion Ambilight Deamon (710)
        Version   : V1.03.0 (GitHub-b8f7642/c5d5f2d-1465599599
        Build Time: Jun 11 2016 01:39:39
    INFO: Selected configuration file: /etc/hyperion/hyperion.config.json.ws281x_spi
    HYPERION INFO: ColorTransform 'default' => [0; 49]
    HYPERION INFO: ColorCorrection 'default' => [0; 49]
    HYPERION INFO: ColorAdjustment 'default' => [0; 49]
    LEDDEVICE INFO: configuration:
    {
        "colorOrder" : "grb",
        "name" : "MyHyperionConfig",
        "output" : "/dev/spidev0.0",
        "type" : "ws2812spi"
    }
    
    INFO: Creating linear smoothing
    HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
    EFFECTENGINE INFO: 27 effects loaded from directory /usr/share/hyperion/effects
    EFFECTENGINE INFO: Initializing Python interpreter
    INFO: Hyperion started and initialised
    INFO: Boot sequence 'Rainbow swirl' EFFECTENGINE INFO: run effect Rainbow swirl on channel 0
    BLACKBORDER INFO: threshold set to 0 (0)
    BLACKBORDER INFO: mode:default
    started
    INFO: Json server created and started on port 19444
    INFO: Proto server created and started on port 19445
    EFFECTENGINE INFO: effect finished
    
     
  13. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    You could try the SPI loop back test.

    Grab spitest.c from a Google search and then hook a wire from MOSI to MISO
     
  14. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    Ah, thanks :) These are my first ventures with Pi GPIO... so far I've only used arduino's and custom eeproms to control electronics so it's a bit of a slow start.

    Anyway... I've tried the loopback test and it indeed confirms that the Pi is at least partially dead. No useful output whatsoever from the SPI device.
     
  15. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Bummer - there's always PWM or USB arduino
     
  16. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    I've added sk6812rgbw-spi support in Hyperion-ng
     
    • Like Like x 1
  17. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    I have everything set up on a Pi2 now and it appears to be working :)

    The only problem I have right now is that it appears to be limited to 341 leds. Since leds * colours per led * spi bytes per colour = 341 * 3 * 4 = 4092 I'm guessing there is some 4k limit somewhere in the SPI code but I haven't been able to find it yet.

    Do you have any idea @penfold42 ?
     
  18. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
  19. penfold42

    penfold42 Moderator Developer

    Messages:
    399
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Good find !

    Have you tested it with newer kernels that use the DMA driver by default ?

    316 was the max I could test with - a 16x16 matrix + 60 led ring
     
  20. Wolph

    Wolph New Member Developer

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +AtmoOrb, +nodeMCU/ESP8266
    Not sure if this kernel has the DMA driver by default but I'm running this one: Linux raspberrypi 4.4.19-v7+ #906 SMP Tue Aug 23 15:53:06 BST 2016 armv7l GNU/Linux

    Seems pretty recent :)
     
Thread Status:
Not open for further replies.