Skip to content

USB-CDC Serial stops working after WiFi.softAPConfig() with custom IP on ESP32-S3 #12081

@roozea

Description

@roozea

Board

ESP32-S3 Dev Module

Device Description

Electronic Cats WiFi Dev Board - an ESP32-S3 based board designed as a Flipper Zero add-on.

Key detail: This board uses native USB-CDC for serial communication. There's no external UART chip (like CH340 or CP2102) - it uses the ESP32-S3's built-in USB peripheral.

Hardware Configuration

Nothing else attached. Just the board connected to a computer via USB-C cable.

Using the native USB port for both power and serial communication (USB CDC On Boot: Enabled).

Version

v2.0.7

Type

Bug

IDE Name

Arduino IDE 2.3.4

Operating System

26.2 Beta (25C5048a)

Flash frequency

40MHz

PSRAM enabled

no

Upload speed

921600

Description

The Problem

When calling WiFi.softAPConfig() with any custom IP address on an ESP32-S3 using native USB-CDC, serial communication dies immediately and never recovers.

What happens

  1. Serial works fine at startup
  2. I call WiFi.softAPConfig(customIP, customIP, netmask)
  3. Serial output freezes instantly - nothing more prints
  4. WiFi AP starts correctly (I can see the network and connect to it)
  5. Serial never comes back, even after WiFi is working

Expected behavior

Serial should keep working after WiFi.softAPConfig(), regardless of the IP address.

Tested IPs

IP Address Serial works?
192.168.4.1 (default, no softAPConfig call) ✅ Yes
192.168.4.1 (explicit call) ❌ No
192.168.1.1 ❌ No
10.0.0.1 ❌ No
4.3.2.1 ❌ No
8.8.8.8 ❌ No

Any call to softAPConfig() breaks serial, even with the default IP.

Why this matters

For captive portal projects, Samsung phones need a "public-looking" IP to trigger automatic portal detection. The workaround (not calling softAPConfig) limits functionality.

Sketch

#include <WiFi.h>

IPAddress apIP(4, 3, 2, 1);
IPAddress netMsk(255, 255, 255, 0);

void setup() {
    Serial.begin(115200);
    delay(2000);
    
    Serial.println("=== USB-CDC + WiFi.softAPConfig Test ===");
    Serial.println("[1] Serial is working fine here");
    Serial.println("[2] Configuring WiFi mode...");
    
    WiFi.disconnect();
    delay(100);
    WiFi.mode(WIFI_OFF);
    delay(100);
    WiFi.mode(WIFI_AP);
    delay(100);
    
    Serial.println("[3] About to call WiFi.softAPConfig()...");
    
    // *** THIS LINE KILLS SERIAL ***
    WiFi.softAPConfig(apIP, apIP, netMsk);
    delay(100);
    
    // Nothing below this point ever prints
    Serial.println("[4] softAPConfig done - you won't see this");
    
    WiFi.softAP("TestNetwork", "");
    delay(100);
    
    Serial.println("[5] AP started at IP:");
    Serial.println(WiFi.softAPIP());
}

void loop() {
    Serial.println("Loop...");
    delay(1000);
}

Debug Message

=== USB-CDC + WiFi.softAPConfig Test ===
[1] Serial is working fine here
[2] Configuring WiFi mode...
[3] About to call WiFi.softAPConfig()...


That's it. Output stops completely after line [3]. 

No crash, no Guru Meditation error, no backtrace - just silence. The WiFi network "TestNetwork" appears and works, but serial is dead.

Other Steps to Reproduce

Steps

  1. Get any ESP32-S3 board that uses native USB (no external UART chip)
  2. In Arduino IDE: Tools → USB CDC On Boot → Enabled
  3. Upload the sketch above
  4. Open Serial Monitor at 115200 baud
  5. Reset the board
  6. Watch - output stops after "[3] About to call..."

Workaround

Don't call WiFi.softAPConfig() at all. Just use:

WiFi.softAP("NetworkName", "");

This uses the default 192.168.4.1 and serial keeps working.

My theory

WiFi.softAPConfig() seems to trigger a TCP/IP stack reconfiguration that somehow disrupts the USB-CDC driver. Maybe shared DMA buffers or some internal resource conflict specific to ESP32-S3's native USB implementation?

Boards tested

  • Electronic Cats WiFi Dev Board (ESP32-S3) → issue present
  • ESP32-S3-DevKitC → issue present (based on community reports)

Original ESP32 (non-S3) boards don't have this issue because they use external UART chips.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions