Closed psitech closed 6 years ago
WS2812Serial BasicTest works at 106 LEDs, 107 and more does not work. 106 LEDs defined:
Sketch uses 16092 bytes (25%) of program storage space. Maximum is 63488 bytes. Global variables use 5900 bytes (72%) of dynamic memory, leaving 2292 bytes for local variables. Maximum is 8192 bytes.
107 LEDs defined:
Sketch uses 16092 bytes (25%) of program storage space. Maximum is 63488 bytes. Global variables use 6160 bytes (75%) of dynamic memory, leaving 2032 bytes for local variables. Maximum is 8192 bytes.
You're running out of RAM. Even though it looks like you have 3568 bytes left, unfortunately FastLED is allocating a bunch of RAM with malloc(), which Arduino can't know in advance and show you in this summary.
There is a known bug in Serial1, Serial2 and Serial3 which causes them to consume RAM, even if you don't ever use them. So you might be able to get a little more by editing those files in hardware/teensy/avr/cores/teensy3. You can also try editing usb_desc.h to reduce the number of USB buffers.
Unfortunately, beyond trying to trim other memory usage, there just isn't much anyone can do. FastLED's features need RAM, and the USB code and other infrastructure does too, all functions & interrupts need stack space for their local variables, and this library needs 15 bytes per LED. Teensy LC simply does not have a lot of RAM. To use a lot of LEDs with this non-blocking library, you need more RAM. You'll need to step up to Teensy 3.2 or 3.5 or 3.6.
Or if you can live with the normal blocking I/O, just use FastLED's normal driver.
Hi Paul, thanks for your detailed explanation. Learned a bit again. At this moment, I don't have a specific need for non-blocking I/O, I was just playing with your new library whan I ran into this behaviour. And I just used a Teensy LC since it has this useful 5V output to drive WS2812 LED strips. FastLED's normal driver works for me with driving 144 LEDs.
Regards, Paul
Platform: Teensy LC [pin 24 wired to pin 17], Arduino 1.8.5, Teensyduino 1.40, latest FastLED lib with WS2812Serial support [downloaded on Nov 2], 144pcs WS2812B LED strip.
When I define more than 89 LEDs, LED strip stays blank.
89 LED's defined:
90 LEDs defined:
Regards, Paul