Another flickering problem.... I'm putting together the hardware for the next version of the

Another flickering problem…

I’m putting together the hardware for the next version of the Too Bright Hat. This time around it’s 430 APA102 LEDs, controlled by a Teensy 3.1 and powered by three lithium cells via a 40 Watt UBEC.

Running a test with the Adafruit DotStar library reveals that the hardware is working fine, no flickering. However,using FastLED causes flickering, as in the video.

The code is simple, no brightness control or power management. It isn’t a power issue, as it occurs when only one LED is commanded to turn on (the driver can run 200 LEDs at a single colour, although the battery Voltage sags a tad). It isn’t due to trying to update too fast (I’ve tried as slow updates as 100 ms). The flicker does flick with each update though.

Any suggestions?

Ok, in the time it took to upload the video, I had an idea and tried changing the clock speed on the Teensy.

Flickering only occurs at 96 MHz. Dropping this solves the flickering problem. 72 MHz works fine.

Nvmd.

Can I see your code for both the FastLED version and the adafruit dotstar version of your test? I want to run them side by side here with a scope to see what might be happening (but my suspicion is that I’m driving the clock line at a higher data rate than the adafruit library is and some wiring setups have problems with that). (Please use gist or GitHub to post them, don’t post code in g+ comments, too much mangling happens)

No problem. I’ve just hacked around the NoiseWithPalette example code:

FastLED, flickers at 96 MHz:

Adafruit DotStar, doesn’t flicker at 96 MHz:

Both of those gists are FastLED based

Also, any particular reason you aren’t using the hardware spi pins?

I think I know what might be causing bitbang’d flickering at higher clock speeds - I do some adjustment, for hardware spi, to account for the fact that above a certain CPU clock rate, the spi max clock rate stops going up, I suspect that is causing the bitbang’d output to drive way too fast when you’re at 96mhz, but I’ll have to verify it to be sure (and the problem may be less of it going too fast and more with the clock line transition timings not quite being right, but again, I want to run it on a scope and see what things actually look like).

Sorry, pasted wrong code. Here’s the DotStar code that doesn’t flicker at 96 MHz:

As for not using the hardware SPI pins, I’m using hardware that I designed before I knew about those. Still, on the staff I’m getting 2 ms updates, which looks pretty… So it’s not a big issue for me at present.

Ok - I’ll get into it with hardware later tonight or tomorrow (great timing, I set aside part of this weekend to do a bunch of checking on teensy related code/performance)

Thanks very much for the support.

This is Burning Man project 6 of 7. I’m very relieved to get it working, especially as project 7 may well have the same issue.

Hey sorry for reviving this. I’m running into a similar issue with flickering and weird artifacts using FastLED on a Teensy, with APA102 led strips.

Noob question: How did you set the clock rate on a Teensy3.2? I can’t find documentation for how to do that anywhere

@Kevin_Greene No worries. There is a setting in the Arduino IDE, which is how I am uploading code to the Teensy. I think it is under the “Tools” menu.

And there are more complicated ways to do it (https://forum.pjrc.com/threads/25148-CPU-Clock-speed-for-Teensy-3-0) but I have never needed those.

Did anyone find a way to resolve the issue without resorting to slowing the CPU. I had to go all the way down to 8Mhz to completely resolve my flicker

Better to just slow down the spi data rate, as that’s where the apa102’s problems are.