Problem with Nextion Library / Guru Meditation

Hi!

I have a problem that I can't figure out the reason for the error at all.

I made this simple application using Nextion with the library "ITEADLIB_Arduino_Nextion-master":

#include <Nextion.h>
#include <WiFi.h>


NexPicture picWifi = NexPicture(9, 4, "p1");
NexPage page1 = NexPage(9, 0, "page9");
NexPage page2 = NexPage(1, 0, "page1");
NexButton btnStart = NexButton(9, 1, "b0");
NexButton btnBack = NexButton(1, 2, "b1");
NexText txtInit = NexText(9, 5, "txtInit");
#define ssid  "xxxxx"
#define pass  "12341234"

int pageControl = 0;

int timeWifi;

NexTouch *nex_listen_list[] =
{
  &btnStart,
  &btnBack,
  NULL
};

void setup() {

  Serial.begin(9600);
  nexInit(115200);
  btnBack.attachPop(backPage, &btnBack);
  btnStart.attachPop(startPage, &btnStart);
  WiFi.begin(ssid, pass);
  timeWifi = millis();
  page1.show();

}

void loop() {
  nexLoop(nex_listen_list);
  switch (pageControl) {

    case 0:
      if (WiFi.status() == WL_CONNECTED) {
        if ((millis() - timeWifi) > 2000) {
          timeWifi = millis();
          dbSerialPrintln("case 0...");
          //txtInit.setText("Conected!");
          //picWifi.setPic(23);
          commandNextion("picWifi.id=23");
        }
      }
      else {
        dbSerialPrintln("erro case 0...");
      }
      break;

    case 1:
      dbSerialPrintln("case 1...");
      break;

  }
}

void commandNextion(String obj)
{
  nexSerial.print(obj);
  nexSerial.write(0xFF);
  nexSerial.write(0xFF);
  nexSerial.write(0xFF);
}

void startPage(void *ptr)
{
  page2.show();
  pageControl = 1;
}


void backPage(void *ptr)
{
  page1.show();
  pageControl = 0;
}

and when I load the sketch into ESP32 and open the Serial Monitor to see the debug, in a few seconds, about 6~10 seconds later, a Guru Medidation error occurs - StoredProhibed which when decoding always takes me to some functions in the Nextion library:

PC: 0x400ed3e3: readDataMsg() at C:\Users\diasf\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master*NexHardware.cpp* line 138
EXCVADDR: 0xffffffff *
Decoding stack results*
0x400ed3e3: readDataMsg() at C:\Users\diasf\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master*NexHardware.cpp* line 138
0x400ed573: parseRx(unsigned char, int)* at C:\Users\diasf\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master*NexHardware.cpp* line 168
0x400ed581: getEvent(unsigned char)* at C:\Users\diasf\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master*NexHardware.cpp* line 267
0x400ed5da: nexLoop(NexTouch)** at C:\Users\diasf\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master*NexHardware.cpp* line 519
0x400e487e: loop() at C:\Users\diasf\Documents\AppNextion/AppNextion.ino line 38
0x400f4b65: loopTask(void)* at C:\Users\diasf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32*main.cpp* line 19
0x4008932d: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

I was giving the error in setText(), I commented the line, started to give in setPic(), commented the line and now started giving error in NexLoop (nexLoop(nex_listen_list);). The curious thing is that the error does not occur immediately, but after a few seconds of execution. And even more curious: I have other Nextion projects that use this library and that work perfectly with the same functions, but when I loaded this sketch and I got this error, I loaded an old sketch that works and gave the same error in the same functions. Then I got another ESP32, loaded the old one, it worked perfectly. I loaded this new one and gave the error, I loaded the old one again and started to give the same error. I'm really confused. I don't know if it's because I'm loading on ESP32 without any connection on RX2/TX2, which is where nexSerial is configured, I don't know what it can be anymore.

Does anyone know what can it be? Or is there any familiarity with this error that might give me some hint, even for me to understand better.

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.