5 years ago.

Increase the maximum number of LEDs

Hi,

Is it possible to increase the maximum number of LEDs from 60? Or is there a stack limit?

Thanks!

Question relating to:

Test program for my Multi_WS2811 library that started out as a fork of heroic/WS2811. My library uses hardware DMA on the FRDM-KL25Z to drive up to 16 strings of WS2811 ... DMA, FRDM-KL25Z, KL25z, led, WS2811, WS2812
Comment on this question

1 Answer

5 years ago.

The maximum number of LEDs is actually 16 x 60 = 960 (16 strings of 60).

I was only using 8 bits of output the way I connected my board, so I can run 8 x 60 LEDs from the 8 bits on PORTD.

The limit is due to the small (16K) RAM size on that board, and the way I'm using the DMA requires a chunk of RAM in addition to the LED color data.

Each LED requires 3 bytes of RAM to store the RGB information, plus the DMA requires 192 bytes per LED of maximum strip length. So for 60 LEDs per string, the static data would be 60 x 192 = 11520 bytes. Add to that (16 x 60 x 3) = 2880 bytes of LED color data.

There is a discussion of memory usage at the top of my WS2811.cpp file.

You can change MAX_LEDS_PER_STRIP in WS2811.h (currently 60).

You can change the output port in WS2811.cpp if you want more than 8 strips driven (there are only 8 pins available on PORTD on this board).

Just change these lines to refer to a port other than PORTD/PTD:

static PORT_Type volatile * const IO_PORT = PORTD; static GPIO_Type volatile * const IO_GPIO = PTD;

It's likely that this library would work on (say) the FRDM-KL46Z which has 32K of RAM; I haven't tried this yet. You'd be able to have longer LED strings on that board if it did work.


You need to log in to post a question