Skip to content

ESP32 C3 S2 softap fails to start with no error condition #7232

@tablatronix

Description

@tablatronix

Board

esp32 c3 devkit

Device Description

espressif devkit tested
G3v01 tested
Possible also an ESP-Sx issue

Hardware Configuration

nothing special

Version

v2.0.4

IDE Name

pio

Operating System

macos

Flash frequency

40

PSRAM enabled

no

Upload speed

921600

Description

For some reason if you toggle sta on and off, softap fails to start an AP, but everything in code appears to start successfully..

I imagine there is some event missing in arduino or a state in IDF that is not returning properly.

I am not sure exactly how many times once or twice toggling sta back or the sta state when begin is called..

Sketch

// wifi_basic.ino

#include <arduino.h>
#include <WiFi.h>
#include <esp_wifi.h>  

void setup(){
	Serial.begin(115200);
	delay(2000);
	Serial.println("Startup....");
	Serial.setDebugOutput(true);

	WiFi.begin("hellowifi","noonehere");
	
    while (WiFi.status() != WL_CONNECTED && millis()<10000) {
        delay(500);
        Serial.print(".");
    }

	if(WiFi.status() == WL_CONNECTED){
		Serial.println("");
		Serial.println("WiFi connected.");
		Serial.println("IP address: ");
		Serial.println(WiFi.localIP());
	}
	else {
		Serial.println("WiFi NOT CONNECTED, starting ap");
                 // WiFi.mode(WIFI_AP_STA); // <------- WORKAROUND SET AP MODE FIRST ?????
		WiFi.enableSTA(false);      // < ------  BUG BREAKS SOFTAP
		delay(2000);		
	    WiFi.softAP("espsoftap","12345678"); // no errors that I can see, but ap never shows up
	}
}

void loop(){

}

Debug Message

Startup....
[  2160][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  2189][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started
[  2190][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START
[  2192][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[  2194][E][WiFiSTA.cpp:317] begin(): connect failed! 0x300a
................WiFi NOT CONNECTED, starting ap
[ 10195][V][WiFiGeneric.cpp:341] _arduino_event_cb(): STA Stopped
[ 10196][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 3 - STA_STOP
[ 12205][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 12215][V][WiFiGeneric.cpp:390] _arduino_event_cb(): AP Started
[ 12216][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 10 - AP_START

Other Steps to Reproduce

Cannot test in 2.0.3 due to bootloader crashes

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

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions