libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
402 stars 59 forks source link

Wifi connection cannot be restored from ap mode #169

Open esnet146 opened 1 year ago

esnet146 commented 1 year ago

Realtec board: wr2; framework: arduino; platform: libretiny @ 1.2.0 ESPHome version 2023.9.0-dev compiled on Sep 13 2023, 20:43:14 Version: v1.2.0 on wr2, compiled at Sep 13 2023 20:14:01, GCC 10.3.1

[D][wifi:425]: Starting scan...
[D][wifi:440]: Found networks:
[I][wifi:483]: - 'gdfskllls' (**:**:**:**:**:05) ▂▄▆█
[D][wifi:485]:     Channel: 2
[D][wifi:486]:     RSSI: -33 dB
[I][wifi:483]: - 'gdfskllls' (**:**:**:**:**:D8) ▂▄▆█
[D][wifi:485]:     Channel: 11
[D][wifi:486]:     RSSI: -72 dB
[D][wifi:488]: - 'esnet' (**:**:**:**:**:05) ▂▄▆█
[D][wifi:488]: - 'esnet' (**:**:**:**:**:B3) ▂▄▆█
[D][wifi:488]: - 'ROSTELECOM_AA84' (**:**:**:**:**:85) ▂▄▆█
[I][wifi:274]: WiFi Connecting to 'gdfskllls'...
[I][wifi:557]: WiFi Connected!
[C][wifi:379]:   Local MAC: **:**:**:**:**:82
[C][wifi:380]:   SSID: 'gdfskllls'
[C][wifi:381]:   IP Address: 10.1.1.131
[C][wifi:382]:   BSSID: **:**:**:**:**:05
[C][wifi:384]:   Hostname: 'realtec'
[C][wifi:386]:   Signal strength: -33 dB ▂▄▆█
[C][wifi:390]:   Channel: 2
[C][wifi:391]:   Subnet: 255.255.255.0
[C][wifi:392]:   Gateway: 10.1.1.1
[C][wifi:393]:   DNS1: 10.1.1.1
[C][wifi:394]:   DNS2: 10.1.1.1
[D][wifi:566]: Disabling AP...

... disable wifi ssid gdfskllls

[W][wifi_lt:288]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
[I][wifi:274]: WiFi Connecting to 'gdfskllls'...
E [    441.208] WIFI: Connection failed; ret=-1
[W][wifi_lt:119]: esp_wifi_connect failed! 4
[E][wifi:320]: wifi_sta_connect_ failed!
[W][wifi_lt:288]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
[D][sensor:093]: 'WiFi_Signal.realtec': Sending state 0.00000 dBm with 0 decimals of accuracy
[D][wifi:425]: Starting scan...
[D][wifi:440]: Found networks:
[D][wifi:442]:   No network found!
[D][wifi:425]: Starting scan...
[D][wifi:440]: Found networks:
[D][wifi:488]: - 'esnet' (**:**:**:**:**:05) ▂▄▆█
[D][wifi:488]: - 'esnet' (**:**:**:**:**:D8) ▂▄▆█
[D][wifi:488]: - 'ROSTELECOM_AA84' (**:**:**:**:**:85) ▂▄▆█
[W][wifi:494]: No matching network found!
[D][wifi:425]: Starting scan...

.... several unsuccessful connection attempts

[W][wifi:494]: No matching network found!
[W][wifi:624]: Restarting WiFi adapter...
[W][wifi_lt:288]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
[W][component:204]: Component wifi took a long time for an operation (0.32 s).
[W][component:205]: Components should block for at most 20-30ms.
[D][wifi:425]: Starting scan...
[W][component:204]: Component wifi took a long time for an operation (0.16 s).
[W][component:205]: Components should block for at most 20-30ms.
[I][wifi:153]: Starting fallback AP!
[W][wifi_lt:288]: Event: Disconnected ssid='' bssid=00:00:00:00:00:00 reason='Unspecified'
E [    500.346] WIFI: Couldn't restore STA mode: (null)
[C][wifi:227]: Setting up AP...
[C][wifi:229]:   AP SSID: 'Rtl Fallback Hotspot'
[C][wifi:230]:   AP Password: '********'
[C][wifi:239]:   IP Address: 192.168.4.1
[W][component:204]: Component wifi took a long time for an operation (1.78 s).
[W][component:205]: Components should block for at most 20-30ms.
[E][wifi:433]: Scan timeout!
[D][sensor:093]: 'WiFi_Signal.realtec': Sending state 0.00000 dBm with 0 decimals of accuracy
[D][wifi:425]: Starting scan...

... enable wifi ssid gdfskllls

[D][sensor:093]: 'uptime_sensor.realtec': Sending state 521.50000 s with 0 decimals of accuracy
[E][wifi:433]: Scan timeout!
[D][wifi:425]: Starting scan...
[D][sensor:093]: 'WiFi_Signal.realtec': Sending state 0.00000 dBm with 0 decimals of accuracy
[E][wifi:433]: Scan timeout!
[D][sensor:093]: 'uptime_sensor.realtec': Sending state 821.50000 s with 0 decimals of accuracy
[D][wifi:425]: Starting scan...
[E][wifi:433]: Scan timeout!
[D][wifi:425]: Starting scan...
[D][sensor:093]: 'WiFi_Signal.realtec': Sending state 0.00000 dBm with 0 decimals of accuracy
[D][sensor:093]: 'uptime_sensor.realtec': Sending state 881.49799 s with 0 decimals of accuracy
[E][wifi:433]: Scan timeout!
[D][wifi:425]: Starting scan...

endlessly. Only reboot helps. I can't connect to the access point "Rtl Fallback Hotspot" either.

Everything is fine on bekken chips. only realtek problem

ferbulous commented 1 year ago

What about after ota update? Can it still reconnect to wifi or do you still need to power cycle

Cossid commented 1 year ago

@kuba2k2 wrong tag, should be Realtek, not BK7231.

ErwinP commented 7 months ago

Hi, I'm having a similar issue. With the SSID hidden, I cannot connect (even with fast_connect=True). When publishing the SSID it works without issues.

Chip is a Realtek AmebaZ from the Solis Wifi Stick of this wonderful project.

Is there anything I can do to facilitate troubleshooting?

Thank you in advance, Erwin

xjikka commented 4 months ago

Hi, same issue here as ErwinP has. There is no connection with a hidden SSID. Either with or without fast_connect=True. Module board: t102-v1.1 with RTL8710BX Log error: bssid=00:00:00:00:00:00 reason='Unspecified' It works normally with exposed SSID.