Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange delay in transmitting after 60-70 bytes of data #72

Open
melazarus opened this issue Apr 8, 2018 · 1 comment
Open

strange delay in transmitting after 60-70 bytes of data #72

melazarus opened this issue Apr 8, 2018 · 1 comment

Comments

@melazarus
Copy link

melazarus commented Apr 8, 2018

I'm using (abusing) SPI to send data to a WS2812 LED string.

The code (got it from: https://github.com/joosteto/ws2812-spi):

def write2812(spi, data):
    tx=[0x00]
    for rgb in data:
        for byte in rgb:
            for ibit in range(3,-1,-1):
                tx.append(((byte>>(2*ibit+1))&1)*0x60 +
                          ((byte>>(2*ibit+0))&1)*0x06 +
                          0x88)
    spi.xfer2(tx,3200000)

Since the ws2812 only uses one wire for data & clock timing is crucial.

This works perfectly for 5 or fewer pixels, above that the behaviour becomes erratic.
So I connected a scope to the SPI (MOSI) Pin and discovered that after about 60-70 bytes the SPI stops for a brief time (about 5µs).
sceenshot

I don't think this is a buffer issue.

Could this be an issue with the hardware SPI? or maybe the py-spidev?

Oh, I'm using a H2+ CPU on a orange pi zero

@pietrodn
Copy link

Here's a possible solution: joosteto/ws2812-spi#6 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants