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

Thread: APA102 sticking in SPI mode using FastLED.h

  1. #1

    APA102 sticking in SPI mode using FastLED.h

    Hello, any ideas would be much appreciated!

    I tried to use 4 SPI pins to drive 4 strips as suggested in the FastLED library... https://github.com/FastLED/FastLED/w...or-Bit-banging

    It works for a few seconds and then freezes. It works all day long if I un-comment //#define FASTLED_FORCE_SOFTWARE_SPI

    FastLED.addLeds<APA102, 7, 14, RGB>(colors1, NUM_LEDS);
    FastLED.addLeds<APA102, 7, 13, RGB>(colors2, NUM_LEDS);
    FastLED.addLeds<APA102, 11, 13, RGB>(colors3, NUM_LEDS);
    FastLED.addLeds<APA102, 11, 14, RGB>(colors4, NUM_LEDS);

    I tried different teensy speeds and different strip speeds to no avail.

    I'm using teensy3.2, teensyduino 1.29, arduino 1.6.9, octoshield, the latest fastLED.h, windows 7.

    Code:
    //#define FASTLED_FORCE_SOFTWARE_SPI
    #include "FastLED.h"
    
    // How many leds in your strip?
    #define NUM_LEDS 32
    
    // Define the array of leds
    CRGB colors1[NUM_LEDS];
    //CRGB colors2[NUM_LEDS];
    //CRGB colors3[NUM_LEDS];
    //CRGB colors4[NUM_LEDS];
    
    void setup() { 
    
       //FastLED.addLeds<APA102, RGB>(leds, NUM_LEDS); //any and all combinations cause the program to freeze after a few seconds
    
       FastLED.addLeds<APA102, 7,14, RGB>(colors1, NUM_LEDS);
       //FastLED.addLeds<APA102, 7,13, RGB>(colors2, NUM_LEDS);
       //FastLED.addLeds<APA102, 11,13, RGB>(colors3, NUM_LEDS);
       //FastLED.addLeds<APA102, 11,14, RGB>(colors4, NUM_LEDS);
    
    }
    
    void loop() { 
      // Turn the LED on, then pause
      for(int i=0; i<NUM_LEDS; i++){
      colors1[i] = CRGB::Red;
      }
      FastLED.show();
      
      delay(100);
    
      // Now turn the LED off, then pause
      for(int i=0; i<NUM_LEDS; i++){
      colors1[i] = CRGB::Black;
      }
      FastLED.show();
      
      delay(100);
    }
    Click image for larger version. 

Name:	photo 1.jpg 
Views:	151 
Size:	78.5 KB 
ID:	7728Click image for larger version. 

Name:	photo 2.jpg 
Views:	117 
Size:	92.9 KB 
ID:	7729
    Last edited by hydronics; 07-26-2016 at 03:32 PM. Reason: a bit clearer

  2. #2
    I get the following error when I try to use the latest version of FastLed from github instead of what is packaged in Teensduino. Do I have too many Arduino's installed on my machine (1.67, 1.68, 1.69) cuasing errors? I tried Arduino IDE 1.68 to no avail.

    Code:
    C:\Arduino\libraries\FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.001
    
     #    pragma message "FastLED version 3.001.001"
                         ^
    In file included from D:\test.ino:2:0:
    
    C:\Arduino\libraries\FastLED/FastLED.h: In static member function 'static CLEDController& CFastLED::addLeds(CRGB*, int, int)':
    
    C:\Arduino\libraries\FastLED/FastLED.h:437:47: error: expected type-specifier before 'SixteenWayInlineBlockClocklessCOntroller'
    
             case WS2813_PORTC: return addLeds(new SixteenWayInlineBlockClocklessCOntroller<NUM_LANES, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
    
                                                   ^
    
    C:\Arduino\libraries\FastLED/FastLED.h:437:152: error: expected primary-expression before ')' token
    
             case WS2813_PORTC: return addLeds(new SixteenWayInlineBlockClocklessCOntroller<NUM_LANES, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
    **unrelated issue: The previous IDE version (1.67) errors when compiling FastLed when functions are present in your code. This was fixed by Arduino IDE 1.68.
    Last edited by hydronics; 07-26-2016 at 09:41 PM.

  3. #3
    ****SOLVED****
    Did a clean install of Arduino IDE 1.68 and teensyduino 1.29.
    Exchanged the FastLed.h with the older version 3.1.0 of the FastLed library: Latest commit b01f941 on Sep 23, 2015. =>> per these comment:
    It works but errors when compiling functions. so I moved all the function definitions to the top of the sketch per this post.

    *********
    Just my notes here:

    It does not freeze running simple code with a clean install of Arduino IDE 1.68 and Teensyduino 1.28.

    ...although I got "functions not declared errors" when introducing functions in the loop() when compiling.

    It compiles fine but freezes after a few seconds when running a clean install of Arduino IDE 1.69 and Teensyduino 1.29

    I tried the latest FastLed library 4c32e65 and it still hangs. I had to delete and replace the fastLed.h in the Teensy/hardware folder for it to compile.

    It compiles fine but freezes after a few seconds when running a clean install of Arduino IDE 1.68 and Teensyduino 1.29

    I tried the latest FastLed library 4c32e65 and it still hangs.

  4. #4
    FastLed library is working on a solution to this too:

    https://github.com/FastLED/FastLED/issues/339

  5. #5
    In order to run the LEDs without flickering I had to upload the LEDs running the teensy at 16MHz (no USB), and then I could run the APA102 at 12MHz.
    I'm running four strands of about ~600 LEDs.
    Code:
    FastLED.addLeds<APA102, DATA_PIN1, CLOCK_PIN1, BGR, DATA_RATE_MHZ(12)>(colors1, LED_COUNT);
    If I ran the teensy at 96MHz then almost the entire strip of LEDs would flicker no matter the led DATA_RATE.
    If I tried to run the teensy at say 48MHz, I could run the APA102 at 1MHz and there would be almost no flicker but the response time was slow. It didn't seem to matter if I ran them combined SPI pins (as my initial post) or ran them as forced software SPI via an unmutilated octo-shield.

Posting Permissions

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