Okay I have a very weird problem with a new strip of APA102,

Okay I have a very weird problem with a new strip of APA102, teensy 3.1 and a 245HCT level shifter with 100 ohm resistors at the output of both the signal and clock lines.

After about 14 pixels the data is starting to get a bit corrupted, and I can see the red appear getting brighter as you go along the strip. This is running at 96MHz. After about 20 pixels there is no data at all getting to the pixels, they’re just flickering like crazy.

When I drop the clock speed of the teensy to 24 MHz then the data can now propagate to about 150 pixels. Still not nearly enough for this application, but definitely a very large improvement.

Doesn’t seem like a power issue. Just wondering if anyone can diagnose what’s going on as I’m totally lost…?

I’ll post a video once I find my phone if that would be helpful.

I have seen other posts where they reduced the clock going to the APA102 to 12 or even 8Mhz with success. I would keep the Teensy clock as is !

Here’s how to specify the data rate…

FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,DATA_RATE_MHZ(12)>(leds, NUM_LEDS);

Thanks JP, I will give that a go!

Quick question… I am using fastled 3.1, and I think those args are wrong. If you specify the pins, doesn’t that set it to use soft spi and the data rate wont work? It throws an error saying it should be 2 args, which makes sense to me at least.

I’m using the line: FastLED.addLeds<APA102,DATA_RATE_MHZ(12)>(leds, NUM_LEDS);

But it throws a 'could not convert template argument APA102 to ‘EBlockChipsets’…weird. Any ideas?

Ah no, I think you need: FastLED.addLeds<APA102, RGB, DATA_RATE_MHZ(12)>(leds, NUM_LEDS);

Edit:
LEDS.addLeds<APA102,11,13,RGB, 12>(leds,NUM_LEDS); works. :slight_smile: Well it compiles anyway.

That totally worked, thanks!

Yeah so far it seems very few people have made it up to 24mhz without issues. Might be worth documenting…somewhere… haha

Hi @Owen_Brasier , I’m glad you got it going.

I have to say that I have not (yet) played with the APA102 myself and only could point you towards a potential fix.

Ryan Clough, you are right, there has been a few reports of problems driving the APA102 at higher-speeds but there has been successful implementations also !!

I think it has a lot more to do with good wiring practices (or lack of…), noise and crosstalk issues than anything to do with the devices themselves. Not an easy thing to document but certainly something that you should be aware of when you play with any high-speed data transmission.

Hello! Is the above SPI clockrate override documented anywhere? I checked here, but no reference…

I have a colleague who runs his APA102 strips @ 96MHz(overclock) all the time, but for me it wont work until I reduce the Teensy3.1 clock down to 24MHz…then its stable. I suppose this could be lack-of-twisted-pair related or lack-of-level-shifter related.

I just tried this and it works:

#define DATA_PIN 11
#define CLOCK_PIN 13
#define NUM_LEDS 29 //was 310
#define BRIGHTNESS 255
#define LED_TYPE APA102
#define COLOR_ORDER GBR
#define SPI_SPEED_MHZ 12

  FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER, SPI_SPEED_MHZ>(leds,NUM_LEDS);

…but strangely, the last pixel in my 29pixel test string only works when the Teensy3.1 system clock rate is set to 24MHz…hmmm…

With my 310 pixel strip, the 12MHz override works at all Teensy3.1 system clock rates…with slight flicker on the first several pixels @ 96MHz system clock. Interesting how the system clock seems to somewhat affect the pixels even though the “SPI override” stays @ 12MHz.

Seems to be very stable right now with system clock = 24MHz and SPI override = 12MHz.

Seems like a chart is in order sometime later…but things are most likely significantly affected by cabling and the presence of level translators…and probably series resistors…(oh, and what about those decoupling caps?!?)

-frenchy (Steve French)
http://www.voltvision.com

https://github.com/FastLED/FastLED/wiki/Basic-usage describes setting the SPI clock rate.

I have been working on one of my lamps and have one that is currently running 325 apa102 leds driven by a teensy 3.1. I was having the flickering problem after a couple of hundred LEDs. I have just been testing having dropped the teensy speed to 72mhz and the SPI speed to 12Mhz and so far it is very stable:-) - Thanks

Weird, I have a board here that is running 768 apa102’s on a teensy 3.1 running at 96Mhz (and have the SPI running at 24Mhz, max rate for the teensy) and there are no issues. I wonder what’s up with the wiring/power in your setup vs. the board that I’m using here.

@Daniel_Garcia ​, are you using a level shifter (3v3 -> 5v) with your APA102? Thx!!

I haven’t been yet, no.