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

Thread: APA102 investigation. Different libraries, shared clock pin, etc.

  1. #1
    Member dimitre's Avatar
    Join Date
    Aug 2016
    São Paulo

    APA102 investigation. Different libraries, shared clock pin, etc.

    Hello, I'm looking for some advices regarding APA102 LED Strip.

    I've used a lot FastLED library but it now lacks support to Teensy 3.5 and I've researched some options.
    One of them is this one
    which is very simple, and allows you to use only one pin as Clock for all output ports, saving pins.
    in my project it would be OK because all strips are in sync.

    But testing I've found it is a lot slower than FastLED. FastLED itself gets confused when sharing Clock pins.
    It may be because I'm using pin 14 as Clock and it consider SPI. If I force a slower datarate, about 4 Mhz things start to work.

    Do you have any recommendations of libraries, or techniques? I would love an APA102 only library with performance similar to FastLED.
    Thank you

    Click image for larger version. 

Name:	17333215_620142424838378_184875226578812928_n.jpg 
Views:	82 
Size:	135.5 KB 
ID:	10059

  2. #2
    Senior Member
    Join Date
    Jun 2013
    Torrance CA
    In the library APA102.h transfer() function replace the digitalWrite() statements with digitalWriteFast(), and be sure in your code your data pin and clock pins are constants or defines. This will speed up the pin twiddling as much as possible; in fact it might make them so fast you might need to insert delays between the digitalWrite(clockPin, HIGH); and digitalWrite(clockPin, LOW); statements so the APA102s have enough time to see the clock.

Posting Permissions

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