fastled lib question about apa102

Status
Not open for further replies.

Vincenet

Active member
Hello,

Few month ago, I used the prop shield to drive an APA102 matrix.

I have not any more a prop shield and I use an other driver.

I do not remenber if I updated my fastled lib but the program controlling the matrix does not work anymore. The hardware setup still works with Adafruit_DotStar.h library.

Back to fastled lib, I probed clock and data signals and I am a bit surprise by the very high frequency (measured period is 84ns), what do you think about this capture?
IMG_20170727_194411783_export.jpg

also, here is my testing code.
View attachment teensy_20170727_pjrcQuestion_apa102.zip
 
I think I am in the same case as here : https://plus.google.com/116805762836780776401/posts/gUDqDhdLf5W
with my driver using BSS138 View attachment BSS138.pdf

PaulStoffregen:
Those I2C level shifters have fast fall time but slow rise time. This difference changes the pulse width. For I2C the sequence of pulses matters, but not their width. For WS2812, the data IS the pulse width. This sort of circuit badly corrupts the waveform.

I am looking for a way to reduce frequency in the library, I confirm it works with the alternate one -Adafruit_DotStar.h- with a resulting period of 820ns.

edit: In my sketch, I change folowing:
Code:
//  FastLED.addLeds<CHIPSET, DATA_PIN,  CLOCK_PIN,  COLOR_ORDER>(leds[0], leds.Size()); // default is DATA_RATE_MHZ(12)
// by
  FastLED.addLeds<CHIPSET, DATA_PIN,  CLOCK_PIN,  COLOR_ORDER, DATA_RATE_MHZ(3)>(leds[0], leds.Size()); // seems works until DATA_RATE_MHZ(6)

edit : DATA_RATE_MHZ(3) is still too high with my wiring. DATA_RATE_KHZ(2600) was OK during testing and I finally chose DATA_RATE_KHZ(100) because with this latest, voltage reach 4V with difficulty. Then measured period is 2us. T_ON duration is about 1.3us.
 
Last edited:
That's right, FastLED uses a default of 12 MHz (83 ns period) for hardware SPI on Teensy 3.x.

It can be configured to run slower. If you have long wires or less capable 3V -> 5V driver chips, you may need to run slower.

FWIW, long ago the default was 24 MHz. Turns out many APA102s can't work reliably at that speed. Each one "regenerates" the clock pulse, but the APA102 circuitry is not accurate in doing so. Usually the regenerated pulse is slightly shorter. After about 100 to 200 LEDs, the 42ns pulse becomes too narrow. The default was changed to 12 MHz, which seems to work well for most projects.
 
Status
Not open for further replies.
Back
Top