Goodmorning everyone. I am developing an application for an electronic Waveshare display, based on a version of ESP32 on IDE Arduino. The directive is to print on the display a bitmap image provided by a webservice at a specific address. Being a beginner, it is not clear to me how to use the GxEPD library to print the bitmap, but this problem is secondary. First of all, I am trying to recover the content of "simpler" web resource, that is a text/plain HTML provided by an ESP8266 that is programmed in such a way as to act as a "basic" web server. In this circumstance, the ESP32 must acquire this brief test text and then display it on the display. However, there is one drawback that I cannot solve. The first GET attempt of the resource by the ESP32 always fails; on the second attempt, instead, it runs, it takes the resource and it prints it on the serial output, but before printing it on the Waveshare display, the system crashes and restarts. This is the serial output:
Display initialized!
HTTP began!
Error on HTTP request
HTTP communication ended
HTTP began!
HTTP GET accepted!
200
Welcome! This is a test page of the ESP8266 Web Server.
.
.
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4015ea54 PS : 0x00060430 A0 : 0x800d4856 A1 : 0x3ffb1ea0
A2 : 0x3ffb1f10 A3 : 0x00000000 A4 : 0x00000625 A5 : 0x3ffc8eb8
A6 : 0x00000001 A7 : 0x00000175 A8 : 0x00000000 A9 : 0x3ffb1e80
A10 : 0x3ffafe88 A11 : 0x00000000 A12 : 0x00000002 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000010 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
Backtrace: 0x4015ea54:0x3ffb1ea0 0x400d4853:0x3ffb1ec0 0x400d48c5:0x3ffb1ee0 0x400d1946:0x3ffb1f00 0x400d8d05:0x3ffb1fb0 0x40088b9d:0x3ffb1fd0
Rebooting...
The esp32 then reboots and restarts with the first request that fails, followed by the second one which is successful and immediately makes it crash and restart again.
The code that is flashed on esp32 is the following one:
#include <GxEPD.h>
#include <GxGDEW075T8/GxGDEW075T8.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>
#include <GxIO/GxIO.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <WiFi.h>
#include <HTTPClient.h>
GxIO_Class io(SPI, /*CS=5*/ 15, /*DC=*/ 27, /*RST=*/ 26); // arbitrary selection of 17, 16
GxEPD_Class display(io, /*RST=*/ 26, /*BUSY=*/ 25); // arbitrary selection of (16), 4
const char* ssid = "joan";
const char* password = "joan1q2w";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Avvio completato!\n");
// setup the display
display.init();
Serial.println("Display initialized!\n");
/* ISTRUZIONI SPECIALI PER IL NOSTRO MODELLO DI ESP32 WAVESHARE */
SPI.end(); // release standard SPI pins, e.g. SCK(18), MISO(19), MOSI(23), SS(5)
SPI.begin(13, 12, 14, 15); // map and init SPI pins SCK(13), MISO(12), MOSI(14), SS(15)
/* FINE ISTRUZIONI SPECIALI */
WiFi.begin(ssid, password);
}
void loop()
{
HTTPClient httpclient;
httpclient.begin("http://172.16.0.104/welcome");
Serial.println("HTTP began!");
int httpCode = httpclient.GET(); // Questo in realtà serve per verificare il codice della richiesta e fare error handling. non è la richiesta vera e propria!
if (httpCode > 0) // Se la GET va a buon fine, posso fare effettivamente l'acquisizione
{
Serial.println("HTTP GET accepted!");
String payload = httpclient.getString(); // ritorna una String con la risposta.
Serial.println(httpCode);
Serial.println(payload);
}
else
{
Serial.println("Error on HTTP request");
}
httpclient.end();
Serial.println("HTTP communication ended");
delay(15000);
}
I also wanted to add that I have tried several web resources, and ESP32 always behaves this way; the first get fails, the second one is successful but crashes the card. I have run out of ideas and can't do further troubleshooting of the code ...
I can't see any end()
function in the Arduino library.
And, as you can see with the output, it is the line who will give you the exception.
So, probably, the IDE is taking the wrong library (the one from Arduino, instead of the one from ESP32).
If it takes the right library, it could also be because you are not waiting for a connection!
It is important to wait, ultil it is connected. Add this at the end of setup:
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
User contributions licensed under CC BY-SA 3.0