Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeoPixel can crash system. #9903

Closed
1 task done
Spaceballs3000 opened this issue Jun 19, 2024 · 8 comments · Fixed by #9906
Closed
1 task done

NeoPixel can crash system. #9903

Spaceballs3000 opened this issue Jun 19, 2024 · 8 comments · Fixed by #9906
Assignees
Milestone

Comments

@Spaceballs3000
Copy link

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.
@Spaceballs3000 Spaceballs3000 added the Status: Awaiting triage Issue is waiting for triage label Jun 19, 2024
@me-no-dev
Copy link
Member

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

@Spaceballs3000
Copy link
Author

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
}

@SuGlider
Copy link
Collaborator

Issue confirmed. It is a concurrency problem within neopixelWrite() and RMT.

@SuGlider
Copy link
Collaborator

@Spaceballs3000 - The PR #9906 shall solve this issue. Please test it.

@SuGlider SuGlider added Type: Bug 🐛 All bugs and removed Status: Awaiting triage Issue is waiting for triage labels Jun 20, 2024
@SuGlider SuGlider added this to the 3.0.2 milestone Jun 20, 2024
@Spaceballs3000
Copy link
Author

@Spaceballs3000 - The PR #9906 shall solve this issue. Please test it.

Tested fix, I do not get the crashes anymore.
Thanks!

@Nourbakhsh-Rad
Copy link

Nourbakhsh-Rad commented Sep 9, 2024

@SuGlider I still have this problem!
I am using the Adafruit_NeoPixel 'simple.ino' sketch for testing

Board: ESP32 Dev Module (ESP32-devkitC-v4)
Hardware Configuration: ESP32 Dev Module
Version: v3.0.4
IDE Name: Arduino IDE 2.3.2
Operating System: Windows 10
Flash frequency: 80
PSRAM enabled: no
Upload speed: 921600

@SuGlider
Copy link
Collaborator

SuGlider commented Sep 9, 2024

@SuGlider I still have this problem!
I am using the Adafruit_NeoPixel 'simple.ino' sketch for testing

Do you mean that using this example, it fails?

This is Adafruit repository. It sounds like some other users have reported similar issues, there.
Please check/post an issue at https://github.com/adafruit/Adafruit_NeoPixel/issues

@ladyada - FYI.

@Nourbakhsh-Rad
Copy link

Nourbakhsh-Rad commented Sep 9, 2024

@SuGlider I still have this problem!
I am using the Adafruit_NeoPixel 'simple.ino' sketch for testing

Do you mean that using this example, it fails?

This is Adafruit repository. It sounds like some other users have reported similar issues, there. Please check/post an issue at https://github.com/adafruit/Adafruit_NeoPixel/issues

@ladyada - FYI.

Yes, this example
Note that, I am using the latest version of the Adafruit_NeoPixel library and the Arduino ESP32 core 3.0.4

Similar issue reported in #401 and #9903 and #9906 and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants