← index #15563Issue #16771
Related · medium · value 2.760
QUERY · ISSUE

ESP32 wifi issues

openby fjmtttyopened 2024-07-28updated 2025-03-03
bugport-esp32needs-info

Port, board and/or hardware

ESP32

MicroPython version

esp32-20220618-v1.19.1.bin

Reproduction

Issue No.1:On startup
Issue No.2:On startup / while running

Expected behaviour

Connected to the wifi smooth and keep that.

Observed behaviour

Issue No.1: "Wifi internal error" occurs. After power off and on, sometimes it works but mostly not. Once it gets recovered, it keep working without any error which looks strange for me. Just adding print(anything) may have solved...

Issue No.2:I'm using 30+ ESP32 with micropython. Most of them connect wifi smooth and keep it. But some 1 or 2 of them suddenly start struggling to connect wifi when start up(cannot connect even after the reboot, unplug power and plug) or lose connection when it's working. But after a while, it works completely normal. The boards which have this issue is random.

(1)This is the code to connect wifi.

"""Wifi"""
def connect_wifi(ssid, passkey, timeout=5): 
global speed_filtered, bias, speed_raw 
wifi= network.WLAN(network.STA_IF)
wifi.active(False)
time.sleep(1)
wifi.active(True)
wifi.connect(ssid, passkey)
start = time.time()
start_count = time.time()
while not wifi.isconnected():
    print('*')
    time.sleep(1)
    if time.time()-start > timeout:
        wifi.disconnect()
        time.sleep(1)
        wifi.connect(ssid, passkey)
        start = time.time()
    
if wifi.isconnected():
    print('Connected')
    print(time.time() - start_count)
    return wifi

.
(2) this is the code to check wifi status. if it's not connected, it try to reconnect.

if wifi.isconnected():
    if wifi_strength > 80:
        wifi_strength_category = 4
    elif wifi_strength > 60:
        wifi_strength_category = 3
    elif wifi_strength > 40:
        wifi_strength_category = 2
    else:
        wifi_strength_category = 1
else:
    wifi = connect_wifi(SSID_NAME, SSID_PASS)

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

ESP32-S3-WROOM-N8R2 WiFi Wont Connect

closedby PsuFanopened 2025-02-17updated 2025-03-02
bugport-esp32

Port, board and/or hardware

ESP32-S3-WROOM-N8R2

MicroPython version

MicroPython v1.24.1 on 2024-11-29; Generic ESP32S3 module with ESP32S3

Reproduction

from network import WLAN
sta = WLAN(0)
sta.active(1)
sta.connect('net', 'pass')
sta.ifconfig()

Expected behaviour

('192.168.1.100', '192.168.1.1', '0.0.0.0', '0.0.0.0')

Observed behaviour

I (47019) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (47019) wifi:state: init -> auth (b0)
I (51319) wifi:state: auth -> init (200)
I (51319) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (51319) wifi: STA_DISCONNECTED, reason:2:
I (53729) wifi: STA_DISCONNECTED, reason:205:

Additional Information

This a dual USB C board, I saw closed issues with this, txpower=17 did not work, tried both usb ports, no change. Tried WPA and no security on AP, no change. Other ESP32 and ESP32-S3 boards connect to AP fine. Almost decided to use ESP32 for project but some dumb ass decided to make the HSPI miso pin 12, which is a strapping pin.

Also tried all other 1.24.1 ports in the generic esp32-s3: 4mb flash and Support for Octal-SPIRAM. No errors were seen on any of the ports. This does usually fix WiFi issues. Am able to preform scan() properly. Probably similar to my issue #15602

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied