NeoPixel can crash system.
Spaceballs3000 opened this issue · comments
Board
ESP32S3 Dev Module
Device Description
ESP32S3 Dev Module
Hardware Configuration
ESP32S3 Dev Module
Version
v3.0.1
IDE Name
Arduino IDE 2.3.2
Operating System
Windows 10
Flash frequency
80
PSRAM enabled
yes
Upload speed
921600
Description
System will crash if data is received on port 6656. If you comment out either the one in main or UDP callback function, it will work fine.
Sketch
#include "WiFi.h"
#include "AsyncUDP.h"
#define RGB_BRIGHTNESS 20 // Change white brightness (max 255)
#define RGB_BUILTIN 21
const char * ssid = "xxxx";
const char * password = "xxxx";
AsyncUDP udp_in;
void setup()
{
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
WiFi.waitForConnectResult();
udp_in.listenMulticast(IPAddress(239,1,2,3), 6656);
udp_in.onPacket([](AsyncUDPPacket packet) { udpRXCallBack(packet); });
}
void loop()
{
neopixelWrite(RGB_BUILTIN,0,0,0); // off
}
void udpRXCallBack(AsyncUDPPacket &packet)
{
neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
}
Debug Message
ESP-ROM:esp32s3-20210327
assert failed: xEventGroupClearBits event_groups.c:495 (xEventGroup)
Backtrace: 0x40376f76:0x3fca5310 0x4037d42d:0x3fca5330 0x40383119:0x3fca5350 0x4037ff5e:0x3fca5480 0x420068c3:0x3fca54a0 0x4200697e:0x3fca54e0 0x42006796:0x3fca5500 0x42002e6a:0x3fca5590 0x42002e8e:0x3fca55b0 0x42005c0d:0x3fca5640 0x42005c62:0x3fca56e0
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
you should not just have neopixelWrite(RGB_BUILTIN,0,0,0);
in the loop. There should be delay or this should be called just once
you should not just have
neopixelWrite(RGB_BUILTIN,0,0,0);
in the loop. There should be delay or this should be called just once
I still hit crashes with an delay, i.e.
void loop()
{
delay(1);
neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,RGB_BRIGHTNESS,RGB_BRIGHTNESS); // White
}
void udpRXCallBack(AsyncUDPPacket &packet)
{
neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
}
Issue confirmed. It is a concurrency problem within neopixelWrite()
and RMT.
@Spaceballs3000 - The PR #9906 shall solve this issue. Please test it.
@Spaceballs3000 - The PR #9906 shall solve this issue. Please test it.
Tested fix, I do not get the crashes anymore.
Thanks!