adafruit / Adafruit_DotStar_Pi

DotStar module for Python on Raspberry Pi
GNU General Public License v3.0
60 stars 30 forks source link

LED Strip flickers red when updating #3

Closed tinue closed 9 years ago

tinue commented 9 years ago

When running the strand test, LEDs flicker red periodically. It's a bit complicated to explain which ones, so I'll need a few bullets:

PaintYourDragon commented 9 years ago

Sounds more power- or signal-level related than a software issue; Pi+strips are working normally here.

If you post on forums.adafruit.com (with pics of your wiring, describe power supply, etc.) we can better troubleshoot the issue there.

jbreiden commented 8 years ago

I just hit this myself using a 3 meter, 150 LED strip driven from a Raspberry Pi 3 in bitbang mode. Used the Adafruit 10A power supply injected at the input, without a smoothing capacitor. Leveling chip didn't make any difference. Looking at the code, I see board specific tuning parameters with no entry for the Raspberry Pi 3. Switching over to SPI mode solved everything.

RTimothyEdwards commented 6 years ago

I looks like the Pi 2 and Pi 3 are supposed to have the same GPIO address space, but I can't get the GPIO to drive the DotStar except through the SPI pins. Even for the SPI pins, I have to set the speed as low as 2-3 MHz before the LED strip will stop glitching. I don't know how fast the bit-bang mode works, but it could well be above that, which might be why it always glitches. Running at 2MHz is not a problem for my application, but having only two pins to drive four LED strips is. . .

jbreiden commented 6 years ago

Nope.

RTimothyEdwards commented 6 years ago

Okay. For the strip I have, either the timing has changed or the timing relative to the Raspberry Pi 2 clock doesn't work.

I had to do two things in dotstar.c to get this to work right with a Raspberry Pi 3 (and/or whatever version of the LED strip I have):

(1) Change /dev/mem to /dev/gpiomem (/dev/mem is only accessibly by root; /dev/gpiomem has group read/write privilege for user "pi").

(2) Shift the pulse in routine clockPulse(). What happens is that the data bit is changed and this is followed immediately by the clock going high. Apparently that's a setup violation on the LED strip.
Instead, I keep the clock low for a count of 40, set high for a count of 70, then set low for a count of 40 again. I can't find any cycle combination that runs faster without causing glitches.

jbreiden commented 6 years ago

You know, I have no idea what is going on electrically over the SPI pings versus the bit bang pins.

RTimothyEdwards commented 6 years ago

I can work that out with an oscilloscope when I have time to get around to it. It's really the only good way to see the relationship between data and clock going into the LED strip.