ESP32 Thing Plus DMX to LED Shield does not run stable

Hi everybody

I need some help with the ESP32 Thing Plus DMX to LED Shield.

I tinkered a little around with some Scripts and was not able to get one of them running stable. All of them - if they even start - crashes after a few ArtNet frames. I tried the Examples from Sparkfun (i had to change some Lines of Code in all of them to get them running) and they failed all in the same way. After the first artnet.read-command the whole thing blocks completly. Sometimes the Code runs a few frames and then blocks too……and once or twice i got the whole thing running for about 5 Minutes, without changing the Code. A weird behavier. I tried several Powersupplys and Routers to connect to…nothing changes.

Ami missing a point or do i use the wrong Librarys? How can i check this?

Thanks for any Tips.

here’s one of my scripts and the Compiler-Output:

Edited by moderator to add code tags.

/*
  Read the 5 Channels of DMX Data coming from an ESP32 shield running Example 1
  By: Andy England
  SparkFun Electronics
  Date: , 2018
  License: GNU. See license file for more information but you can
  basically do whatever you want with this code.
  This example runs two servos and a number of LED's off of 5 DMX channels
  
  Feel like supporting open source hardware?
  Buy a board from SparkFun! https://www.sparkfun.com/products/15110
  Hardware Connections:
  Connect pan/tilt servos to pins DATA1 and DATA2, connect LEDs to CLOCK and DATA0. Connect a DMX XLR-3 Cable in between the Output and Input shields
*/

#include <WiFi.h>
#include <WiFiUdp.h>
#include <ArtnetWifi.h> //https://github.com/rstephan/ArtnetWifi
#include <SparkFunDMX.h>

//Wifi settings
IPAddress local_IP(192, 168, 2, 7);
IPAddress gateway(192, 168, 2, 1);
IPAddress subnet(255, 255, 255, 0);
//IPAddress primaryDNS(8, 8, 8, 8); //optional
//IPAddress secondaryDNS(8, 8, 4, 4); //optional
char ssid[] = "XXXXXXXXXXX"; //Change these lines to an existing SSID and Password if you're trying to connect to an existing network
char password[] = "XXXXXXXXXXXXX";

// Artnet settings
ArtnetWifi artnet;
const int startUniverse = 0;
const int endUniverse = 0;//end Universe should be total channels/512

SparkFunDMX dmx;
WiFiUDP UdpSend;
bool sendFrame = 1;
int previousDataLength = 0;

//Channel and Peripheral Definitions
#define MAX_CHANNEL 513
#define ledPin 13
unsigned long lasttime;


boolean connectWifi(void) //Sets our ESP32 device up as an access point
{
  boolean state = true;
  //WiFi.mode(WIFI_AP_STA);
  //state = WiFi.softAP(ssid, password);
  //Comment out the above two lines and uncomment the below line to connect to an existing network specified on lines 8 and 9
  //Serial.println("Start WLAN");
  state = WiFi.begin(ssid, password);
  return state;
}

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
  sendFrame = 1;
  //Read universe and put into the right part of the display buffer
  //DMX data should be sent with the first LED in the string on channel 0 of Universe 0
  if ((millis()-lasttime) > 500) {
    digitalWrite(ledPin, !digitalRead(ledPin));
    lasttime = millis();
  }

  data[1] = data[0]*data[1]/255;
  data[2] = data[0]*data[2]/255;
  data[3] = data[0]*data[3]/255;
  
  data[8] = data[7]*data[8]/255;
  data[9] = data[7]*data[9]/255;
  data[10] = data[7]*data[10]/255;
  
  data[15] = data[14]*data[15]/255;
  data[16] = data[14]*data[16]/255;
  data[17] = data[14]*data[17]/255;
  
  data[22] = data[21]*data[22]/255;
  data[23] = data[21]*data[23]/255;
  data[24] = data[21]*data[24]/255;
  
  data[29] = data[28]*data[29]/255;
  data[30] = data[28]*data[30]/255;
  data[31] = data[28]*data[31]/255;
  
  data[36] = data[35]*data[36]/255;
  data[37] = data[35]*data[37]/255;
  data[38] = data[35]*data[38]/255;
  
  data[43] = data[42]*data[43]/255;
  data[44] = data[42]*data[44]/255;
  data[45] = data[42]*data[45]/255;
  
  data[50] = data[49]*data[50]/255;
  data[51] = data[49]*data[51]/255;
  data[52] = data[49]*data[52]/255;

  Serial.print(data[0]);
  Serial.print(" ");
  Serial.print(data[1]);
  Serial.print(" ");
  Serial.print(data[2]);
  Serial.print(" ");
  Serial.print(data[3]);
  Serial.println(" ");
  
  for (int channel = 0; channel < length; channel++)
  {
    dmx.write(channel + 1, data[channel]);//Add one for offset
  }
  previousDataLength = length;
  if (universe == endUniverse) //Display our data if we have received all of our universes, prevents incomplete frames when more universes are concerned.
  {
    dmx.update();
	UdpSend.flush();
  }
}

void setup()
{
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  lasttime = millis();
  //Fixture Hardware Declarations
  dmx.initWrite(MAX_CHANNEL);//Resolume sends full ArtNet packets so that's what we listen for
  if (!WiFi.config(local_IP, gateway, subnet)) {

    Serial.println("STA Failed to configure");

  }
  Serial.print("Connecting to ");
  Serial.println(ssid);
  if (connectWifi())
  {
    Serial.println("Connected!");
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
  }
  artnet.begin();
  artnet.setArtDmxCallback(onDmxFrame);
  delay(1000);
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
}

void loop()
{
    int wifi_retry = 0;
    while(WiFi.status() != WL_CONNECTED && wifi_retry < 5 ) {
      wifi_retry++;
      Serial.println("WiFi not connected. Try to reconnect");
      Serial.println(WL_CONNECTED);
      WiFi.disconnect();
      WiFi.mode(WIFI_OFF);
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, password);
      delay(1000);
    }
    if(wifi_retry >= 5) {
      Serial.println("\nReboot");
      ESP.restart();
    }
  artnet.read();
}

Where are you sending ArtNet data from?

Also, can we see your Serial output when the code blocks and resets?