Had a chance to play around with APA102 data rate and a sexy oscilloscope. Using a Teensy 3.1, pins 11 & 13 (hardware SPI), FastLED 3.1 (latest) and a single 4m strip of APA102 60LEDs/m.
I tested the clock pin at 16MHz (always stable in my tests) and 24MHz (always unstable) and probed at the output pin, the beginning, middle and end of the strip. At 24MHz the LEDs around the middle of strip started going haywire, and at the end they were always glitchy.
You can see in the pics below that the clock signal degrades as we travel down the strip, even at 16MHz. I did not see as bad of a degradation in the data signal, probably because it changes voltage less often (on average).
I wanted to learn if the problem was the controller, the wire leading to the first LED, or the strip. Putting a 100ohm or 330ohm resistor inline didn’t seem to make a positive difference.
It seems as though the problem is just signal degradation as it travels down the strip. However, I’m no expert so if someone has other ideas, please chime in.
interesting. does anyone know if the APA102s have signal shaping similar to ws2812 (iirc)? Otherwies I cant imagine a reasonable solution to an issue of down-strip signal degradation.
Even if it does reshape, perhaps the reshaping just doesnt handle well at this speed?
@Stuart_Taylor excellent question. I was driving home and realized that I wasn’t moving my ground down the strip along with the probe :. So, I’m back at the lab now re-doing the tests. However, I’m still seeing similar, although not as extreme, degradation. Towards the end of the strip, the clock signal is a relatively constant +3v. I’m running the strip @ 4v to more closely match the Teensy’s outputs.
I’m not using a level shifter. This is mysterious. Let me see if I can get any new info when actually doing the test correctly.
@Gabriel_Schine I’m puzzled by the chips not regenerating the data and clock. Can you run the strip @ 5v and drive the 1st pixel from the teensy’s ~3.3v ? It should then regen @ 5v
Ok, driving the LEDs @ 5v doesn’t seem to make much of a difference (FYI @ 5.2 they start flickering. Don’t do this).
With proper grounding, I have the following updated observations:
a) the clock signal is inverted from one LED to the next
b) right about where the first flickering LED is, the clock appears good (visual inspection only), but farther down, it is degraded (random/intermittent voltage spikes).
c) measuring from one voltage rise to the next yields a frequency of ~12 MHz, meaning that the chip is using the rising and the falling edge (hence I guess why it can safely invert the clock).
d) driving at 5v, the signal is only just over 4v at the first pixel, and drops from there (measured @ ~3.2 v about 2.5m in).
e) i don’t know at what clock voltage the chip reads a bit, but measuring the time between the up-edge and the down-edge on the clock at the beginning of the strip yields ~24ns, and towards the middle-ish ~13ns (it gets shorter). Eventually the clock line reads either always-high or always-low. Anyone understand the datasheet enough to know what threshold the chip uses to read a bit?
@Stuart_Taylor If they always regenerated the signal, then wouldn’t that prevent this horrible flickering from happening, period? At that point I’d think that as long as the first pixel gets good data, all the pixels will get good data. That does not appear to be the case. Again, though, I’m an EE newbie.
It might also pay to source a known working, known Greeled-manufactured strip for comparison. There are clones of everything and there are manufacturing faults
I was under the impression that once the data was getting sent pixel to pixel (ie from a pixel’s controller chip to the next) that that data wouldn’t get messed up since the chip would be sending out a nice clean signal each time. Is it possible that the chip is indeed sending out clean signal, but it’s just not the correct signal? As in, maybe it received a garbled signal in (from the very first pixel down the line) and is cleanly and accurately passing that garbled signal on?
I also ran across this blog post of someone else investigating the APA102C protocol and thought this paragraph was an interesting observation:
“The LED output color is updated immediately after the first valid LED frame. This is quite interesting, since it means that almost arbitrary update rates of the APA102 are possible. However, this may lead to a “staggered” update for longer strings, where the first LEDs in a string are updated earlier than the later ones. The best way to work around this is to use a sufficiently high SPI clock rate.”
From here: https://cpldcpu.wordpress.com/2014/11/30/understanding-the-apa102-superled/
@Mike_Thornbury that’s a good point. I got mine from Ray Wu’s store. Can someone recommend a source for known GreeLED manufactured strips?
@marmil it really does not appear to be the case, at least for the clock signal. I found that the data signal looked significantly better, even down the line, so maybe this reshaping is only happening on the data line? The clock signal became less and less clear the further from the first LED I got.
@Gabriel_Schine Actually, the APA102 was designed by APA Electronic co. LTD.
Strangely enough their datasheets are crap and the best datasheet I managed to download was from http://www.gree-leds.com/
@marmil I read that blog post (again now that I’ve played with the scope), and it’s much clearer to me. So, the clock is still only used on the rising edge, and the inversion is to accommodate a slight delay in signal forwarding. I’ll have to re-measure the clock frequency on the scope at various SPI frequencies again to see what’s going on there.
@JP_Roy I didn’t measure the voltage drop. I’ll head back to the lab on Monday morning to answer any new questions/suggestions that come up. I measured the voltage variation on the DC power supply at ~2.6mA so that seemed pretty clean. It’s a nice power supply (I forget the brand).
@Gabriel_Schine From what I gather, Ray Wu is one of the more reputable sellers.
But… as with anything electronic in China - everything is cloned. APA being a Taiwanese company, their costs will be higher, so it wouldn’t be a surprise to see clones already.
I wonder if it’s worthwhile getting a strip from APA in Taiwan to act as a reference?
@Gabriel_Schine can you try to measure the signal and clock after setting 5V DC and GND each meter - to avoid dropping in the voltage. And I really recommend to you using a level shifter for signal and clock. The internal IC of the APA is really good in pushing the signals to 5 V, but the waveform is not that clear as you pass in allready 5 V
@Gabriel_Schine if you are down to 3.2v ~2.5m into the strip, its a bit of a big ask for the silicon to stay locked onto the rising edge, when down stream LEDs are going to pull that line lower.