Important changes to questions
We’re making some changes to Mbed Questions. From 10th December 2019 this site will be archived and new questions should be asked on our new forum site. Until that date you can continue to reply to existing questions here but can’t ask new questions.
5 years ago.
Increase the maximum number of LEDs
Is it possible to increase the maximum number of LEDs from 60? Or is there a stack limit?
Question relating to:
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