Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: fastled lib question about apa102

  1. #1

    fastled lib question about apa102

    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?
    Click image for larger version. 

Name:	IMG_20170727_194411783_export.jpg 
Views:	101 
Size:	113.9 KB 
ID:	11097

    also, here is my testing code.
    teensy_20170727_pjrcQuestion_apa102.zip

  2. #2
    I think I am in the same case as here : https://plus.google.com/116805762836...ts/gUDqDhdLf5W
    with my driver using BSS138 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 by Vincenet; 08-09-2017 at 04:40 PM.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,791
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •