Hi everyone! Intention: For my audio visualisation stuff I need more than 1 kfps.

Hi everyone!

Intention: For my audio visualisation stuff I need more than 1 kfps. Seriously.

Test setup: 288 APA102, Teensy 3.1, FastLED 3.001.001, IDE 1.6.5

Problem: If I run the SPI with more then 12 MHz the end of the led strip shows stuff that is not in the leds array (random flicker that particularly looks like mirroring other parts of the strip). No matter if HW or SW SPI is used. With 24MHz it´s only the first few leds that work properly.

Anything I can do about it? What surprises me is that the error starts within the line of APAs. How can this happen when every LED is refreshing the signal? Or am I wrong with this assumption?

Thanks for suggestions, Stefan.

I have no answers but this is something I would really be interested to understand also. Seems like some setups are able to handle higher MHz rates while others must lower for it to work. I wish we could have several hundred APA102 users report their setup specifics and the MHz rates that work for them so this could be analyzed and sorted out.

You didn’t mention it with your setup, but curious if you are using:
A level shifter (74HCT245)?
Resistor on data line?
Injecting power every so often down your strip?

Thanks for your reply, @marmil . At the moment I use no level shifter and no resistor. Injecting power every 144 leds. The maximal current is less than 2 A - so the powering should be fine.

@Stefan_Petrick ​ if you have a fast enough oscilloscope (nyquist sampling theory says 2x the sampling freq), you should check what the data looks like at the end of your strip. At 24MHz interesting laws of radio propagation come into play. You may be getting ringing or reflected data signal, or even data induced into the clock or vice versa. A scope would help diagnose this.
24MHz is 12.5m wavelength. What is your strip length?

@Stuart_Taylor striplength is 2 m + 30 cm cable inbetween + 40 cm cable from the Teensy to the strip. Oh, and 15 cm at the open end.
I have only an old 15 MHz analog scope and the logic analyzer is also no help to show the signal quality. What kind of temination would you try to reduce signal reflections?

Even with a 15 Mhz old scope, assuming it is still functional, you should be able to probe both clock and data signals along the length of the strips to see wave shapes !

Check for ringing on the transitions, excessive rounding of the square wave shape. It is easier to do on the clock, the data will probably require you to somehow store the signal to see it !

How good is your logic analyser !?
the trick with them is to find the right trigger mode. It is not the best to check for signal quality but may show you the actual bit errors that cause the artefacts that you see.

@Stefan_Petrick the signal rise time is 0.5ns; that translates under consideration of cable impedence in a ‘save’ wire length of 17.5 cm.
Longer than that you have to cope with wave reflections.

You could try twisted data cables and/or experiment with Resistors 20 … 120 Ohm (in small steps); also use it in the CLOCK line. Resistors in series, close to the µC; this is called Source Termination.


@Juergen_Bruegl “the signal rise time is 0.5ns; that translates under consideration of cable impedence in a ‘save’ wire length of 17.5 cm.
Longer than that you have to cope with wave reflections.”
I assume that the signal is refreshed by every single APA (?) - so the distance between the leds is something like 2mm. But the flickering starts somewhere along the strip. I could understand if it wouldn´t work at all but I struggle to understand why the error happens in the middle of the strip. What am I overlooking here?
The Source termination I will try when I find the right resistors, thanks for the hint!

@Stefan_Petrick I assume that the signal is refreshed by every single APA (?)
Yes it is !
The clock is actually inverted at each device so must be driven out !
The data also is only passed out following reception of first 32 data bits following 32 bits start frame so is re-generated.

yes, the signal is refreshed but I don’t believe the CLOCK is.

The APA102 delays the data on the output by half a cycle. This is accomplished by inverting the incoming clock signal at the output.

@Stefan_Petrick is the result the same if you slow down your updates (e.g. 10fps) but still use the 24MHz SPI?

@Louis_Beaudoin1 Yes, same result. With 24 MHz / 1000 fps the first 70 leds work fine, everything beyond becomes chaotic. With 24 MHz / 10 fps it looks the same, just slower.

Which buffer chips are you using between the Teensy and APA102? Or are you just running the Teensy 3.3V signals directly to the 5V LEDs?

I recently tested several different chips. The SN74AHCT1G08 (and similar) work the best.

At the moment I use no level shifter - so just 3,3 V signals directly to the LEDs.

Would it be useful to wire in a variable resistor so the value could be dialed up/down for experimenting? Something like:

What about backing the LED strip with a long thin strip of metal (insulated from touching the strip contacts of course). Could that possibly help with interference? Just brain storming here…

Interesting, thanks for the info @PaulStoffregen

Hi @marmil , in my humble opinion, no resistor of any size on either the data or clock line either at the beginning or as termination will help with Stefan’s issue since data is correctly received in the first pixel and up to 70 pixels at 24 Mhz.
What I think is happening here (note that this is a WAG… IE: Wild Ass Guess) is cumulative degrading of the clock signal. That would have to be caused by parasitic capacitance in the actual strips wiring !
I am doubtful about the effectiveness of shielding in this case but it may be something worth trying but before I would try that, I would try something a bit easier that has greater potential for improvements…
IE: To improve power distribution by one or more of the following…

  1. Heavier wires
  2. Inject power every 1/2 meter
  3. Add small decoupling caps distributed on the strip.

Just for the record: at 24 MHz the data signal at the end of the strip is pretty rounded.
The clock signal swings with a very high frequency and amplitude when it is high. I guess that causes the problem.
Btw: A big thanks to everyone who shares informations, knowledge and ideas here! What a great community!