Can I use ESPAsyncWebServer over Ethernet ? (Arduino-ESP32 v1.04)

pataga
Posts: 73
Joined: Sat Aug 12, 2017 5:53 am

Can I use ESPAsyncWebServer over Ethernet ? (Arduino-ESP32 v1.04)

Postby pataga » Sat Feb 06, 2021 2:47 pm

I have a basic EthernetWebServer library example working using SPI interface to ENC28J60. No problem running a simple 'hello world' web server.

I then tried running a simple AsyncWebServer example over Ethernet. I have the Ethernet interface up and an IP address allocated via DHCP. But the AsyncWebServer crashes on the server.begin() call. What else should I be doing, or is there some issue with the AsyncWebServer library working over ethernet ?

Thanks for any pointers ...

Code: Select all

#include <SPI.h>
#include <UIPEthernet.h>
//#include <EthernetWebServer.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01};
AsyncWebServer server(80);

void setup(void)
{
    Serial.begin(115200);
    while (!Serial)
    {
    }
    Serial.println("\r\nStarting AsyncWebServer on ESP32 enet");

    // Use DHCP dynamic IP
    //Ethernet.begin(mac, ip);
    Ethernet.begin(mac);

    Serial.print(F("Connected! IP address: "));
    Serial.println(Ethernet.localIP());
    delay(1000);

    server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
        request->send(200, "text/plain", "Hello, world");
    });
    server.begin();
}

void loop(void)
{
}
Serial monitor output is :

Code: Select all

Starting AsyncWebServer on ESP32 enet
Connected! IP address: 10.42.0.251
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40088071 on core 1

Backtrace: 0x4008b744:0x3ffb1da0 0x4008b975:0x3ffb1dc0 0x40088071:0x3ffb1de0 0x400fda96:0x3ffb1e20 0x400fdb72:0x3ffb1e40 0x400f2540:0x3ffb1e60 0x400f25a9:0x3ffb1e80 0x400f3b00:0x3ffb1ea0 0x400f3bec:0x3ffb1ed0 0x400d5411:0x3ffb1ef0 0x400da52e:0x3ffb1f40 0x400d18e2:0x3ffb1f60 0x400dc313:0x3ffb1fb0 0x40088385:0x3ffb1fd0
And backtrace decode using EspExceptionDecode shows the exception occurs at line 94 : server.begin()

Code: Select all

Decoding stack results
0x4008b744: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
0x4008b975: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
0x40088071: xQueueGenericReceive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1442
0x400fda96: sys_mutex_lock at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/port/esp32/freertos/sys_arch.c line 78
0x400fdb72: sys_arch_protect at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/port/esp32/freertos/sys_arch.c line 469
0x400f2540: do_memp_malloc_pool at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/memp.c line 302
0x400f25a9: memp_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/memp.c line 398
0x400f3b00: tcp_alloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c line 1661
0x400f3bec: tcp_new_ip_type at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c line 1782
0x400d5411: AsyncServer::begin() at /home/hari/Arduino/libraries/AsyncTCP/src/AsyncTCP.cpp line 1274
0x400da52e: AsyncWebServer::begin() at /home/hari/Arduino/libraries/ESPAsyncWebServer/src/WebServer.cpp line 84
0x400d18e2: setup() at /home/hari/work/synectix/AsyncEnetServer/AsyncEnetServer.ino line 94
0x400dc313: loopTask(void*) at /home/hari/.arduino15/packages/esp32/hardware/esp32/1.0.4/cores/esp32/main.cpp line 14
0x40088385: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

Who is online

Users browsing this forum: nnangeroni and 41 guests