SK9822 LEDS broken on Teensy 4.1

niteris

Member
I have an existing project that uses 570 SK9822 leds in one strip. Currently I'm using a Teensy 3.6 and everything works very well. I'm trying to migrate to Teensy 4.1 so I can take advantage of POV. However I've realized that Teensy 4.1, for whatever reason, has major problems with the SK9822 chipset at every clock configuration for both the MCU and also for SPI (hardware and soft-spi).

The issue is that the is a *lot* of flicker and this flickering is greatly reduced as I touch different components on the board, indicating that it has something to do with the capacitance and resistance of the circuit. I want to add that when I switch to using some old APA102 led's they work flawlessly. However SK9822 fails to work in the following strips sizes: 1 led, 7 leds, 570 leds.

Reducing flickering

I was able to reduce flickering by following this reddit thread:
https://www.reddit.com/r/FastLED/comments/e971oz/leds_in_my_custom_string_flicker_closer_towards/

Which pointed to this graphic showing that there was a Vspike of 1-2v at ~100nA:
https://s8.hostingkartinok.com/uploads/images/2019/12/27920b2f79209eb1b05a0ba55e3274c5.jpg

I followed the instructions in the above graphic, though I didn't have the exact resistors, so I applied the following substitutions:

(see graphic above)
470 -> 1k
100k -> 320k

That is:


MCU Data Out ---> Resister 1k ---> LED Data In

Resister 1k ----> Ground


The result was that MOST of the flicker was gone. However flickered returned when the teensy was connected to both the computer through the USB AND connected to a USB battery through the 5v and ground pads.

Obviously this persistent flicker shows that the LEDs are operating at the limits, so I tried to improve things further. I noticed that when I touched the data and clock pins that the flicker would go away. I'm guessing that some sort of ripple was being absorbed the capacitance of my body. I noticed too that I could merely put on a allegator clip and the length of that wire hanging freely was enough to nearly eliminate the the flicker, thus allowing me to increase the MHZ of the SK9822 so to push it further to the limits. My experimentation ended when I reversed a large capacitor into the clock pin which immediately fried the board. So no more playing around for me.

See code below for minimal test case, again this works for any size SK9822 led strip. I tested that this failed on pins data/clock: 1/0 & 26/27.

Possible causes:
* It's possible this is a problem with the FastLED library and the difference between how it initializes / bit-bangs the pins.
* An MCU or PCB board difference between Teensy 3.6 and 4.1 which puts the SK9822 chipset out of spec with respect to the pin manipulation.

I'll cross file an issue with FastLED at their github incase this is a library issue.




Code:
#include <FastLED.h>

#define NUM_LEDS 570
#define PIN_CLOCK_MHZ 1  // Any setting fails.
#define LED_CHIPSET SK9822
#define PIN_DATA 26
#define PIN_CLOCK 27
#define LED_ORDER BGR


CRGB leds[NUM_LEDS] = {};

void setup() {
  FastLED.addLeds<LED_CHIPSET, PIN_DATA, PIN_CLOCK, LED_ORDER>(leds, NUM_LEDS);
}

void loop() {
  for (int i = 0; i < NUM_LEDS; ++i) {
    leds[i] = CRGB::White;
    FastLED.show();
    delay(1);
    leds[i] = CRGB::Black;
  }
}
 
Please install 1.56-beta3.

https://forum.pjrc.com/threads/68748-Teensyduino-1-56-Beta-3

Multiple bugs in FastLED were recently fixed. If you're using any earlier version, you're probably seeing those bugs.

Pay close attention to any messages Arduino prints about duplicate libraries. The copy with these bugs fixed will be in {Arduino}/hardware/teensy/avr/libraries/FastLED. If you have other copies, especially anything in {Documents}/Arduino/libraries, they may be overriding the bug-fixed copy Teensyduino installed.
 
Yup, it looks like this was the case:

C:\Users\niteris\Documents\Arduino\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

Also I notice that platformio is using teensy 1.55, not 1.56-b. Any ETA on when the beta will make it to release?

For a fix, do you recommend pulling out FastLED from the teensy library and stuffing it into a local src?
 
Back
Top