Skip to content

WS2801 Timing issue - Calling FastLED.show() too quickly does not update the LEDs. #6

Closed

Description

@mtnocean

This is the RGBCalibrate code stripped down to the bare minimum. It works as long as there is a delay after FastLED.show(). Change the delay (1) to delay (0) and it no longer updates the LEDs.

#include "FastLED.h"
#define NUM_LEDS 6
CRGB leds[NUM_LEDS];

void setup() {
   delay(2000);
   FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
}

void loop() {
   leds[0] = CRGB::Red; 
   leds[1] = CRGB::Green;
   leds[2] = CRGB::Green;
   leds[3] = CRGB::Blue;
   leds[4] = CRGB::Blue;
   leds[5] = CRGB::Blue;
   FastLED.show();
   delay(1);
}

Activity

  1. focalintent commented on Jan 20, 2014

    @focalintent
    Contributor

    Ah - yeah - I know what this is. There's conflicting reports on how much of a delay WS2801's require between data writes to allow data to latch out/be displayed. I've had data sheets give me numbers anywhere from 24-500µs. The current code has a 500µs forced delay between frames, I don't know if the issue is that it isn't a long enough of a delay or that the micros() function on arduino's isn't exact enough and so we're not waiting long enough.

    A couple of questions:

    • What platform are you running/testing this on? (teensy 3, arduino, something else?)
    • If you go into chipsets.h and around line 96 change CMinWait<500> to something like CMinWait(750) or CMinWait<1000> and remove your delay(1) - do either of those changes help things at all?

    Thanks for the report! (Unfortunately, there appears to be some variation in ws2801 chip manufacturers, and the ws2801's that I have here work with the code in its current state, which makes testing that this problem is taken care of locally is tricky).

  2. mtnocean commented on Jan 21, 2014

    @mtnocean
    Author

    You're welcome. I'm glad I could help in my small way. You are doing so much for all of us. I realize that this chip must be a real headache for you. Thank you.

    I know that updating so quickly like this isn't a common use case. I found this while writing a simple exercise, kind of like the blink without delay sketch.

    I'm running an AdaFruit DC Boarduino with a 16 MHz ATmega 168. The docs state "Diecimila / Duemilanove compatible." http://www.adafruit.com/products/72

    Removing the delay (1) and changing the line in chipsets.h to 1000 fixes it; 750 does not:
    CMinWait<1000> mWaitDelay;

    Here is the behavior for the range of values between the < > :

    • Below 650, as before, no update.
    • Between 675 to 925 it sends different kinds of garbage, sometimes down the whole length of the strip.
    • Above 950 updates properly.

    The chips on the strip are marked WS2801SO XW130702. It is not marked with a brand or worldsemi. I have a chain of those WS2801 bullet lights, http://www.adafruit.com/products/322, that act the same. I can't see the markings through the plastic. Tell me if it would help to get the markings.

  3. focalintent commented on Jan 21, 2014

    @focalintent
    Contributor

    Ok - I'm going to tweak the code then for the 2.1 branch to use a delay of 1000 then, to be safe. I'd rather have it delay a bit more than it needs to in some cases than run into this again. Thanks for the extra info!

  4. focalintent commented on Jan 21, 2014

    @focalintent
    Contributor

    Fix checked in on the master and 2.1 branches, it'll be in the next release/download that gets spun up for folks. Thanks again!

  5. mtnocean commented on Jan 21, 2014

    @mtnocean
    Author

    You're welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions