Is the maximum number of leds on a single strand 1365?

I'm experiencing a limit to the number of leds in a single strand of 1365 using the OctoWS2811 library on a Teensy 4.1
When I run the code below it fails to update the leds but does not crash.
Is there a limit to the number of leds in a single strand?
I apologize in advance if I missed something while googling this.
I only have one type of strand available to me so I'm not totally certain that it's not the leds themselves.

Code:
#include <OctoWS2811.h>
const int numPins = 1;
byte pinList[numPins] = { 7 };

//const int ledsPerStrip = 1365; //works
const int ledsPerStrip = 1366; //don't


const int bytesPerLED = 3;  // change to 4 if using RGBW
DMAMEM int displayMemory[ledsPerStrip * numPins * bytesPerLED / 4];
int drawingMemory[ledsPerStrip * numPins * bytesPerLED / 4];
const int config = WS2811_GRB | WS2811_800kHz;

OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config, numPins, pinList);

void setup() {
  leds.begin();
  leds.show();
}

#define RED 0x160000
#define GREEN 0x001600
#define BLUE 0x000016

void loop() {
  int microsec = 1000000;

  colorWipe(RED, microsec);
  colorWipe(GREEN, microsec);
  colorWipe(BLUE, microsec);
}

void colorWipe(int color, int wait) {
  for (int i = 0; i < leds.numPixels(); i++) {
    leds.setPixel(i, color);
  }
  leds.show();
  delayMicroseconds(wait);
}
 
Thanks for the link! That must be the root of the problem.
I'm still confused though since he says that's no longer a problem with the 4.1

OctoWS2811 on Teensy 4.1 doesn't have any of these limits. The DMA is automatically partitioned into chunks, so in theory you could have an incredible number of LEDs on each pin.
 
I've at least confirmed that it works at all with fastLed with no parallel output. So it must be something with the DMA code in the OctoWS2811 library.
 
Opps, I misspoke about "OctoWS2811 on Teensy 4.1 doesn't have any of these limits". Been a while since I wrote that code. The DMA channel doing the middle of each frame that actually transmits data is using chunks that could scale up to larger sizes. But the other DMA channels that create the start and end of each bit are a single large transfer, the same as on Teensy 3.x.

So the total transfer per pin on Teensy 4.x is limited the 32K bits, which is 1365 RGB LEDs or 1023 RGBW LEDs. Because the communication is 800 kbits/sec, the fastest possible refresh rate with length of LED strip is about 24 Hz.

You can still use the pinlist feature to get more than 8 pins.
 
aww hell, I designed this project assuming I could do 20 pins at ~3000 leds each 10fps. These super tight led strips add up fast! Thanks for the response though!
 
Might work if you delete the delay code in the library, and of course use a delay in your program before starting another beginning transfer.
 
I'll try that, I assume I'd also have to change the buffer pointers to the second half of the data before calling show for the second half or just have the isr call it if theres any data left.

Alternately, I'm also looking into using the ESG feature on dma1 and 3.
 
well that worked. removing the while loop from the end of show() allows for calling show again, potentially after copying new data into the displayMemory. you just need to wait for busy() to return false before calling show the first time to avoid interrupting a frame in progress.

Code:
//remove line #317 from OctoWS2811_imxrt.cpp to allow a hack for > 1365 leds

#include <OctoWS2811.h>
const int numPins = 1;
byte pinList[numPins] ={7};// { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };

const int ledsPerStrip = 1024;
//const int ledsPerStrip = 1365; //works
//const int ledsPerStrip = 1366; //don't


const int bytesPerLED = 3;  // change to 4 if using RGBW
DMAMEM int displayMemory[ledsPerStrip * numPins * bytesPerLED / 4];
int realDrawingMemory[ledsPerStrip * numPins * bytesPerLED / 4];
int* drawingMemory = (int*)realDrawingMemory;
const int config = WS2811_GRB | WS2811_800kHz;

OctoWS2811 leds(ledsPerStrip / 2, displayMemory, drawingMemory, config, numPins, pinList);

void setup() {
  leds.begin();
  leds.show();
}

#define RED 0x160000
#define GREEN 0x001600
#define BLUE 0x000016

void loop() {
  colorWipe(RED, 0);
  colorWipe(GREEN, 0);
  colorWipe(BLUE, 0);
}

void colorWipe(int color, int wait) {
  for (int i = 0; i < leds.numPixels(); i++) {
    leds.setPixel(i,color);
    show();
  }

  
}

void show() {
  while (leds.busy()) ;
  leds.show();
  leds.show();//repeats same data on second 1024 pixels
}
 
Back
Top