-
BoardESP-C3-OLED Device DescriptionStock device Hardware ConfigurationNo change Versionv3.3.3 TypeBug IDE NameArduino-IDE Operating SystemGentoo Linux Flash frequency80Mhz PSRAM enabledno Upload speed921600 DescriptionI have an ESP32-C3-OLED board which works well when I do It works well with all theses 3. But when I add either ArduinoOTA or WebServer, it crashes. Any help will be appreciated Sketch#include <lwip/sockets.h>
#define PORT 80
static int sock;
int setup_tcp() {
int ip_protocol = 0;
int addr_family = AF_INET6;
struct sockaddr_in6 dest_addr;
if (addr_family == AF_INET) {
struct sockaddr_in *dest_addr_ip4 = (struct sockaddr_in *)&dest_addr;
dest_addr_ip4->sin_addr.s_addr = htonl(INADDR_ANY);
dest_addr_ip4->sin_family = AF_INET;
dest_addr_ip4->sin_port = htons(PORT);
ip_protocol = IPPROTO_IP;
} else if (addr_family == AF_INET6) {
bzero(&dest_addr.sin6_addr.un, sizeof(dest_addr.sin6_addr.un));
dest_addr.sin6_family = AF_INET6;
dest_addr.sin6_port = htons(PORT);
ip_protocol = IPPROTO_IPV6;
}
sock = socket(addr_family, SOCK_STREAM, ip_protocol);
if (sock < 0) {
return -1;
}
int err = bind(sock, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
if (err < 0) {
}
err = listen(sock, 4);
return 0;
}
void setup() {
Serial.begin(115200);
Serial.println("ESP32-C3 sensor starting");
Serial.print(heap_caps_get_free_size(MALLOC_CAP_8BIT));
//wserver.on("/", doweb);
//wserver.onNotFound(doweb);
//wserver.begin();
setup_tcp();
}
static int c;
static int uptime;
void loop() {
delay(1000);
if (c++ > 50) {
c = 0;
Serial.print("ALive");
Serial.println(uptime++);
}
}Debug MessageOther Steps to ReproduceFor crashing with WebServer, just add the following line in setup() If I comment wserver.begin(), no crash I have checked existing issues, online documentation and the Troubleshooting Guide
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Hello, as said in the bug report, ArduinoOTA and WebServer crash the same, so using Lwip socket is not the main issue $HOME/.arduino15/packages/esp32/tools/riscv32-esp-elf-gdb/16.3_20250913/bin/riscv32-esp-elf-gdb --batch /tmp/arduino_build_469508/crash.ino.elf -ex "set listsize 1" -ex "l *0x40384ff2" -ex q |
Beta Was this translation helpful? Give feedback.
The issue was a missing WiFi start (via WiFi.mode(WIFI_STA);) BEFORE setting webserver/arduinoOTA