espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.89k stars 7.08k forks source link

Wifi AP on ESP32S3 working in APSTA Mode when connected to a AP, but not when not connected (IDFGH-13130) #14073

Closed diplfranzhoepfinger closed 1 day ago

diplfranzhoepfinger commented 1 week ago

Answers checklist.

General issue report

ESP-IDF 5.2.2

i have a ESP32 Client: it runs "Arduino as ESP-IDF Component"

and a ESP32S3 Server, it runs ESP-IDF. and the Mode is APSTA.

when the APSTA is connected to a AP (Internet Router) everything works well.

when the APSTA is not connected, then the Softap seems not to accept incoming Connections:

try to connect with my Mobile Phone fails. the Client prints:

W (30527) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (30692) wifi:state: auth -> init (200)
I (30692) wifi:new:<1,0>, old:<1,1>, ap:<255,255>, sta:<1,1>, prof:1
W (31037) wifi:sta_scan: STA is connecting, scan are not allowed!
W (31038) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (31549) wifi:sta_scan: STA is connecting, scan are not allowed!
W (31550) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (32060) wifi:sta_scan: STA is connecting, scan are not allowed!
W (32061) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (32248) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (32250) wifi:state: init -> auth (b0)
W (32571) wifi:sta_scan: STA is connecting, scan are not allowed!
W (32572) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (33083) wifi:sta_scan: STA is connecting, scan are not allowed!
W (33084) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (33252) wifi:state: auth -> init (200)
I (33252) wifi:new:<1,0>, old:<1,1>, ap:<255,255>, sta:<1,1>, prof:1
W (33594) wifi:sta_scan: STA is connecting, scan are not allowed!
W (33595) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (34106) wifi:sta_scan: STA is connecting, scan are not allowed!
W (34107) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (34617) wifi:sta_scan: STA is connecting, scan are not allowed!
W (34618) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (34809) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (34811) wifi:state: init -> auth (b0)
W (35128) wifi:sta_scan: STA is connecting, scan are not allowed!
W (35129) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (35640) wifi:sta_scan: STA is connecting, scan are not allowed!
W (35641) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (35812) wifi:state: auth -> init (200)
I (35813) wifi:new:<1,0>, old:<1,1>, ap:<255,255>, sta:<1,1>, prof:1
W (36151) wifi:sta_scan: STA is connecting, scan are not allowed!
W (36152) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (36663) wifi:sta_scan: STA is connecting, scan are not allowed!
W (36664) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (37174) wifi:sta_scan: STA is connecting, scan are not allowed!
W (37175) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (37369) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (37371) wifi:state: init -> auth (b0)
W (37685) wifi:sta_scan: STA is connecting, scan are not allowed!
W (37686) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
W (38197) wifi:sta_scan: STA is connecting, scan are not allowed!
W (38198) wifi:sta_scan: STA is connecting, scan are not allowed!
connecting ...
I (38372) wifi:state: auth -> init (200)
I (38373) wifi:new:<1,0>, old:<1,1>, ap:<255,255>, sta:<1,1>, prof:1

when the STA is connected, then the Client prints:


........
I (633) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
[    51][E][esp32-hal-gpio.c:166] __digitalWrite(): IO 23 is not set as GPIO.
I (651) gpio: GPIO[23]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
[    68][E][esp32-hal-gpio.c:166] __digitalWrite(): IO 18 is not set as GPIO.
I (669) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (670) gpio: GPIO[37]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (679) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (689) main_task: Started on CPU0
I (693) main_task: Calling app_main()
I (738) main_task:M5StickC initializing...I (796) gpio: GPIO[13]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (797) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (804) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (814) gpio: GPIO[23]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
OK
I (1389) gpio: GPIO[37]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1402) wifi:wifi driver task: 3ffc3e30, prio:23, stack:6656, core=0
I (1423) wifi:wifi firmware version: 3e0076f
I (1423) wifi:wifi certification version: v7.0
I (1423) wifi:config NVS flash: enabled
I (1424) wifi:config nano formating: disabled
I (1428) wifi:Init data frame dynamic rx buffer num: 32
I (1433) wifi:Init static rx mgmt buffer num: 5
I (1437) wifi:Init management short buffer num: 32
I (1442) wifi:Init dynamic tx buffer num: 32
I (1446) wifi:Init static rx buffer size: 1600
I (1450) wifi:Init static rx buffer num: 4
I (1453) wifi:Init dynamic rx buffer num: 32
I (1459) wifi_init: rx ba win: 6
I (1461) wifi_init: tcpip mbox: 32
I (1465) wifi_init: udp mbox: 6
I (1469) wifi_init: tcp mbox: 6
I (1473) wifi_init: tcp tx win: 5744
I (1477) wifi_init: tcp rx win: 5744
I (1482) wifi_init: tcp mss: 1440
I (1486) wifi_init: WiFi IRAM OP enabled
I (1490) wifi_init: WiFi RX IRAM OP enabled
I (1499) phy_init: phy_version 4791,2c4672b,Dec 20 2023,16:06:06
I (1584) wifi:mode : sta (50:02:91:8d:db:ec)
I (1585) wifi:enable tsf
I (1589) wifi:Set ps type: 1, coexist: 0

I (3154) wifi:new:<6,2>, old:<1,0>, ap:<255,255>, sta:<6,2>, prof:1
I (3156) wifi:state: init -> auth (b0)
I (3161) wifi:state: auth -> assoc (0)
I (3168) wifi:Association refused temporarily, comeback time 1500 (TUs)
I (4705) wifi:state: assoc -> assoc (0)
I (4711) wifi:state: assoc -> run (10)
I (5799) wifi:connected with 2251, aid = 1, channel 6, 40D, bssid = 34:85:18:a1:e0:7d
I (5800) wifi:security: WPA2-PSK, phy: bgn, rssi: -16
I (5806) wifi:pm start, type: 1

I (5807) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (5813) wifi:dp: 2, bi: 102400, li: 4, scale listen interval from 307200 us to 409600 us
I (5820) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (6831) esp_netif_handlers: sta ip: 192.168.4.2, mask: 255.255.255.0, gw: 192.168.4.1
WiFi connected
IP address: 
192.168.4.2
[HTTP] begin...
[HTTP] GET PRESSURE
I (6871) wifi:<ba-add>idx:0 (ifx:0, 34:85:18:a1:e0:7d), tid:0, ssn:0, winSize:64
[HTTP] GET PRESSURE code: 200
[HTTP] Pressure is0.0 Bar!
[HTTP] begin...
[HTTP] GET PRESSURE
[HTTP] GET PRESSURE code: 200
[HTTP] Status ist0!
[HTTP] begin...
[HTTP] GET PRESSURE
[HTTP] GET PRESSURE code: 200
[HTTP] Pressure is0.0 Bar!
[HTTP] begin...
[HTTP] GET PRESSURE
[HTTP] GET PRESSURE code: 200
diplfranzhoepfinger commented 1 week ago

can it be some thin in FLASH ? so that the Wifi API stores something into flash which makes this Connection run bad ?

diplfranzhoepfinger commented 1 week ago

does this tell something:

appears on the Server when not connected to the Internet AP 

I (52391) wifi:new:<1,1>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (52391) wifi:station: 50:02:91:8d:db:ec join, AID=1, bgn, 40U
I (56456) wifi:station: 50:02:91:8d:db:ec leave, AID = 1, bss_flags is 33786978, bss:0x3c23346c
I (56456) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (116364) wifi:removing station <50:02:91:8d:db:ec> after unsuccessful auth/assoc, AID = 0
W (116364) wifi:rm mis
I (116365) wifi:new:<1,0>, old:<1,0>, ap:<1,1>, sta:<255,255>, prof:1
hansw123 commented 6 days ago

hi @diplfranzhoepfinger I'm sorry I didn't get your point, could you be more specific about the connection between sta, apsta , your phone and router and describe the steps to reproduce the problem, thank you very much for the report!

diplfranzhoepfinger commented 6 days ago

hi, 

seems to be a COEX Problem:

https://docs.espressif.com/projects/esp-idf/en/v5.2.2/esp32s3/api-guides/coexist.html

when BLE Scanner is on, the AP seems not working on ESP32, either Standalone or APSTA:

https://github.com/espressif/esp-idf/tree/master/examples/wifi/getting_started/softAP

https://github.com/espressif/esp-idf/tree/master/examples/wifi/softap_sta

when BLE off, all good. 

when BLE on, only one working is 

https://github.com/espressif/esp-idf/tree/master/examples/wifi/softap_sta

BUT only when the STA is connected first, then the AP works. 

if STA not connected, AP fail.

hansw123 commented 5 days ago

@diplfranzhoepfinger Yes, there are indeed coexisting influences, and in the end, thank you for the report!

Indastri commented 1 day ago

Closing as completed. If you will have any further problems feel free to reopen this or create a new issue.

Cheers!