Allwinner H3 and WS2801 - weird color switch every (un)even value

  • Hello,


    I got Hyperion running on my Allwinner H3 based Orange Pi board - kind of.
    It has a WS2801 RGB LED strip connected via (HW-)SPI and Hyperion is compiled with PLATFORM=x86 and is accessing the LED strip via /dev/spidev.
    Using HyperCon the colors however seemed odd to me, e.g. every time I select "red" in the HyperCon colorwheel I get green.
    I figured it might be RGB confusion (RBG, BGR, BRG, GBR, BRG, ..), however no mode fixed that.


    Then I manually set RGB to 254, 0, 0 instead of 255, 0, 0 and finally my LED strip illuminated red!
    Setting it to 253, 0, 0 however turned it green again. 252, 0, 0 red. So setting the red channel to an even number shows red, as expected, setting it to uneven numbers don't.


    I have dumps of the SPI signal captured by a logicanalyzer as well as an oscilloscope if that's of any help. As I don#t have any other idea, I suspect it being a timing issue.


    Thanks a lot!


    PS: There's no prefix nearly matching my matter.

  • Here's a screenshot showing the SPI-communication.



    First two wires are CLOCK/MOSI connected to the Raspberry Pi.


    Wire 3 and 4 are CLOCK/MOSI connected to the Orange Pi One (Allwinner H3 based).


    I captured both transmissions after another and aligned both in this image for convenience.


    Obvious differences:
    1) MOSI is "high" in default state on H3, while on the RasPi it's "low".
    2) CLOCK gets pulled "high" for ~10µs shortly before transmission starts on H3.
    While those 2 points don't matter at all when complying with the SPI spec, it might be for the WS2801.


    As above mentioned differences seem to occur in HW, I guess I'm stuck here.

  • Apparently I'm not the first noticing that HIGH right before transmission on the SCK line.


    https://github.com/nRF24/RF24/issues/257
    http://linux-sunxi.narkive.com…hen-slave-select-goes-low


    I adapted the hint in the last answer to the sun6i_spi driver and got rid of it. Now things are working smoothly.


  • Sorry I missed this but io now.


    There are 4 different common spi modes with differences in how the clock line works.
    Namely 1) is a clock pulse and low->high or high->low
    2) does the clock idle high or low when finished.


    My guess is the allwinner spi driver is broken and not settingnofnthe SoC SPI controller correctly

  • Sorry I missed this but io now.


    There are 4 different common spi modes with differences in how the clock line works.
    Namely 1) is a clock pulse and low->high or high->low
    2) does the clock idle high or low when finished.


    My guess is the allwinner spi driver is broken and not settingnofnthe SoC SPI controller correctly


    I'm aware of the different modes and already picked the correct one (phase-shift, clock-polarity, ..) when I measured the logic levels.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!