ESP32 RMT Issues: Passing large buffer to rmtWrite causes crash
Posted: Fri Jun 07, 2024 11:48 pm
While attempting to use the Adafruit NeoPixel Library v1.12.2, I discovered that trying to drive more than 70+ pixels will cause the system to crash/boot-loop. I've verified this happens on both my ESP-WROOM-32 and ESP32-C3 boards. I found an issue on the Adafruit repository (https://github.com/adafruit/Adafruit_Ne ... issues/375) and posted details of my findings there. I suspect that it's not uncommon to need to drive 150 pixels (a standard full strip) or more, so the limitation of 70 poses quite a restriction.
Details:
* Arduino IDE 2.3.2
* Board Package: esp32 by Espressif v3.0.1
* Adafruit NeoPixel Library v 1.12.2
* ESP32-S3 and ESP32-C3 chips
When building with the ESP IDF v5.x.x, the Adafruit library simply invokes `rmtInit` then `rmtWrite` in it's driver during the `show()` method. When invoking the `rmtWrite` method with a large buffer, the chip crashes and reboots. I suspect there is some kind of buffer overrun occurring when more than around 1600-1700 RMT Items are passed to the `rmtWrite` method. I assume that there must be some kind of buffer managment going on behind the scenes, since that number of items is far larger than a single channel's block memory (or even all the channels combined). It is interesting to note that size limit is approximately the same on both the S3 vs the C3 chips (even though the C3 has much smaller block memory).
Ideally, not only should the crash be prevented for large item arrays, but also there needs to be a way to handle very large item buffers so that applications using 150, 300, or even 500 WS2812 devices can take advantage of the RMT hardware. Please let me know if there is any additional information or details I can provide to help resolve this issue. Thanks!
Details:
* Arduino IDE 2.3.2
* Board Package: esp32 by Espressif v3.0.1
* Adafruit NeoPixel Library v 1.12.2
* ESP32-S3 and ESP32-C3 chips
When building with the ESP IDF v5.x.x, the Adafruit library simply invokes `rmtInit` then `rmtWrite` in it's driver during the `show()` method. When invoking the `rmtWrite` method with a large buffer, the chip crashes and reboots. I suspect there is some kind of buffer overrun occurring when more than around 1600-1700 RMT Items are passed to the `rmtWrite` method. I assume that there must be some kind of buffer managment going on behind the scenes, since that number of items is far larger than a single channel's block memory (or even all the channels combined). It is interesting to note that size limit is approximately the same on both the S3 vs the C3 chips (even though the C3 has much smaller block memory).
Ideally, not only should the crash be prevented for large item arrays, but also there needs to be a way to handle very large item buffers so that applications using 150, 300, or even 500 WS2812 devices can take advantage of the RMT hardware. Please let me know if there is any additional information or details I can provide to help resolve this issue. Thanks!