esp-iot-bridge icon indicating copy to clipboard operation
esp-iot-bridge copied to clipboard

Unable to see wifi AP when using wifi to wifi interface (AEGHB-863)

Open GuillaumeHupi opened this issue 1 year ago • 4 comments

Checklist

  • [X] Checked the issue tracker for similar issues to ensure this is not a duplicate
  • [X] Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • [X] Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

I use the latest version of esp-iot-bridge library. I use esp-idf V5.3.0. I use ESP32-Ethernet-Kit_V1.2

I use the "WIFI_ROUTER" example. So as described in the User Guide. It should be possible do use wifi interface for both connecting to the external network and providing network data forwarding.

So I configured my project like this : image image

Here is my complete sdkconfig file.

I did not modify the main code, only the sdkconfig.

So what I expect after flashing this to my esp32 is a network called ESP_Bridge to appear. And what I see in the logs indicates that this should be the case :

I (1011) wifi:Disabled PMF config for STA
I (1015) bridge_wifi: [esp_bridge_wifi_set_config] softap ssid: ESP_Bridge password: 12345678
I (1197) wifi:Total power save buffer number: 16
I (1198) bridge_wifi: SoftAP config changed, deauth all station
I (1199) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.5.1
I (1209) button: IoT Button Version: 3.4.0
I (1211) gpio: GPIO[16]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
start web server

Actual behavior (suspected bug)

But I can not see this network appear with any of my devices (macbook or android phone). Even if I try to connect by typing manually ssid and password, It tells me that the network does not exists.

I used the BLE APP to provide the SSID and PASSWORD for the ESP to connect to our wifi router. The esp connected successfully (I can see it with a network analyser). But I still can't see the ESP_Bridge network.

Full logs are added further down in the message.

I should point out that I have tried several configurations, including using Ethernet as the interface used to connect to the external network and WiFi as the interface used to provide network data forwarding for other devices, and in this case, I am able to see the ESP_Bridge network and connect to it. And everything works as expected.

It is only when WiFi is used for both interfaces that I do not see the network appear.

Error logs or terminal output

load:0x40080404,len:3904
entry 0x40080640
I (31) boot: ESP-IDF v5.3-dirty 2nd stage bootloader
I (31) boot: compile time Nov  4 2024 16:32:47
I (31) boot: Multicore bootloader
I (36) boot: chip revision: v3.1
I (40) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (49) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 nvs              WiFi data        01 02 0000d000 00008000
I (77) boot:  1 phy_init         RF data          01 01 00015000 0000b000
I (84) boot:  2 ota_0            OTA app          00 10 00020000 001d0000
I (92) boot:  3 ota_1            OTA app          00 11 001f0000 001d0000
I (99) boot: End of partition table
I (104) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=3afc8h (241608) map
I (195) esp_image: segment 1: paddr=0005aff0 vaddr=3ff80000 size=00004h (     4) load
I (195) esp_image: segment 2: paddr=0005affc vaddr=3ffbdb60 size=0501ch ( 20508) load
I (208) esp_image: segment 3: paddr=00060020 vaddr=400d0020 size=d3044h (864324) map
I (505) esp_image: segment 4: paddr=0013306c vaddr=3ffc2b7c size=01054h (  4180) load
I (507) esp_image: segment 5: paddr=001340c8 vaddr=40080000 size=1e8e4h (125156) load
I (576) boot: Loaded app from partition at offset 0x20000
I (576) boot: Disabling RNG early entropy source...
I (588) cpu_start: Multicore app
I (596) cpu_start: Pro cpu start user code
I (596) cpu_start: cpu freq: 240000000 Hz
I (596) app_init: Application information:
I (599) app_init: Project name:     wifi_router
I (605) app_init: App version:      1
I (609) app_init: Compile time:     Nov  6 2024 09:29:06
I (615) app_init: ELF file SHA256:  a28bfda148184595...
I (621) app_init: ESP-IDF:          v5.3-dirty
I (626) efuse_init: Min chip rev:     v0.0
I (631) efuse_init: Max chip rev:     v3.99 
I (636) efuse_init: Chip rev:         v3.1
I (641) heap_init: Initializing. RAM available for dynamic allocation:
I (648) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (654) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (660) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (666) heap_init: At 3FFCA820 len 000157E0 (85 KiB): DRAM
I (672) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (678) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (685) heap_init: At 4009E8E4 len 0000171C (5 KiB): IRAM
I (693) spi_flash: detected chip: generic
I (696) spi_flash: flash io: dio
I (700) esp_core_dump_flash: Init core dump to flash
E (706) esp_core_dump_flash: No core dump partition found!
E (711) esp_core_dump_flash: No core dump partition found!
I (718) coexist: coex firmware version: dab85ae96
I (724) main_task: Started on CPU0
I (727) main_task: Calling app_main()
I (747) bridge_common: esp-iot-bridge version: 0.11.9
I (749) wifi:wifi driver task: 3ffd0124, prio:23, stack:6656, core=0
I (759) wifi:wifi firmware version: 0caa81945
I (759) wifi:wifi certification version: v7.0
I (759) wifi:config NVS flash: enabled
I (760) wifi:config nano formating: disabled
I (764) wifi:Init data frame dynamic rx buffer num: 32
I (769) wifi:Init static rx mgmt buffer num: 5
I (773) wifi:Init management short buffer num: 32
I (777) wifi:Init dynamic tx buffer num: 32
I (781) wifi:Init static rx buffer size: 1600
I (785) wifi:Init static rx buffer num: 10
I (789) wifi:Init dynamic rx buffer num: 32
I (794) wifi_init: rx ba win: 6
I (796) wifi_init: accept mbox: 6
I (800) wifi_init: tcpip mbox: 32
I (804) wifi_init: udp mbox: 6
I (808) wifi_init: tcp mbox: 6
I (812) wifi_init: tcp tx win: 5744
I (816) wifi_init: tcp rx win: 5744
I (820) wifi_init: tcp mss: 1460
I (824) wifi_init: WiFi IRAM OP enabled
I (829) wifi_init: WiFi RX IRAM OP enabled
I (834) phy_init: phy_version 4830,54550f7,Jun 20 2024,14:22:08
I (903) wifi:mode : null
I (907) wifi:mode : softAP (e4:65:b8:7f:02:49)
I (908) wifi:Total power save buffer number: 16
I (909) wifi:Init max length of beacon: 752/752
I (911) wifi:Init max length of beacon: 752/752
Add netif ap with (commit id)
I (917) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (926) bridge_common: netif list add success
I (933) bridge_common: [WIFI_AP_DEF ]
I (937) bridge_common: Set ip info:192.168.5.1
I (941) bridge_wifi: SoftAP IP network segment has changed, deauth all station
I (952) wifi:Disabled PMF config for SoftAP
I (953) wifi:Total power save buffer number: 16
I (957) bridge_common: DHCPS Restart, deauth all station
I (958) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.5.1
I (972) bridge_common: [WIFI_AP_DEF ]Name Server1: 114.114.114.114
Add netif sta with (commit id)
I (981) bridge_common: netif list add success
I (987) wifi:mode : sta (e4:65:b8:7f:02:48) + softAP (e4:65:b8:7f:02:49)
I (993) wifi:enable tsf
I (996) bridge_wifi: Found ssid *******************
I (1001) bridge_wifi: Found password *******************
E (1006) NVS: Failed to read IP info from NVS
I (1011) wifi:Disabled PMF config for STA
I (1015) bridge_wifi: [esp_bridge_wifi_set_config] softap ssid: ESP_Bridge password: 12345678
I (1197) wifi:Total power save buffer number: 16
I (1198) bridge_wifi: SoftAP config changed, deauth all station
I (1199) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.5.1
I (1209) button: IoT Button Version: 3.4.0
I (1211) gpio: GPIO[16]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
start web server
I (1226) wifi_prov_scheme_ble: BT memory released
I (1228) esp_bridge_wifi_prov_mgr: Starting provisioning
I (1234) esp_bridge_wifi_prov_mgr: Development mode: using hard coded salt
I (1241) esp_bridge_wifi_prov_mgr: Development mode: using hard coded verifier
I (1250) wifi:mode : sta (e4:65:b8:7f:02:48)
I (1256) BTDM_INIT: BT controller compile version [f021fb7]
I (1260) BTDM_INIT: Bluetooth MAC: e4:65:b8:7f:02:4a
I (1429) protocomm_nimble: BLE Host Task Started
I (1437) wifi_prov_mgr: Provisioning started with service name : PROV_7F0248 
I (1440) esp_bridge_wifi_prov_mgr: Provisioning started
I (1442) esp_bridge_wifi_prov_mgr: Scan this QR code from the provisioning application for Provisioning.
I (1452) QRCODE: Encoding below text with ECC LVL 0 & QR Code Version 10
I (1458) QRCODE: {"ver":"v1","name":"PROV_7F0248","username":"wifiprov","pop":"abcd1234","transport":"ble"}
I (1475) NimBLE: GAP procedure initiated: advertise; 
I (1476) NimBLE: disc_mode=2
I (1478) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256
I (1488) NimBLE: 

                                          
  █▀▀▀▀▀█ ███ ▀▄▀▀▀▄▄▄█▄▀▀▄▄▀▀  █▀▀▀▀▀█   
  █ ███ █ █▄▀█ ▄▄▄█▀▀▀▄▀▀█▄▄ ▄█ █ ███ █   
  █ ▀▀▀ █ ▄  ▄▄█▀▀▀  ▄▀█▄▀ ▀█▀  █ ▀▀▀ █   
  ▀▀▀▀▀▀▀ ▀▄▀ █ █ █▄▀ ▀▄▀▄▀ ▀▄█ ▀▀▀▀▀▀▀   
  ▀█ ▄▀█▀   ▄▀▄▄█▄ ▀█▀▄▀██▀▄ █▀▄ █▄▀▀▀▀   
    ▀▀▄█▀  ▄▄█▀▀ ▀█▄  ▄▄▄▀▄ ██▀██ ▀█▄█▄   
  ▀▄ ▄▄▄▀▄ ██ ▀  █▀██▀▀▀ ▄▀▄ ▄▀ ▀█▄▀█▄▀   
   ▀▀ ▀█▀▄█ ▄ ▄ █▀██▀▄▀▄██▀▀▄▀██▄█ █▄     
   ▄  ▄▄▀  ▀▄▀▄▀█▄ ▀█▀▀█ █▀▄▄▄▀██▀▄ ▀▀▀   
  ▀ ▀▄▀▀▀▀█▄██▀█▀█▀▄ ▄ █▄▀█ ████ █▄▀▄▄▄   
  ▄ ▀█▀ ▀█▄ █ ▀█▄▄█▀ ▀▀▀ ▄ ▄ ▄▀██▀▄█▀█▀   
  ██  █▀▀▀▀▀▀ ▄ ▄▀██▀ ▀▄█▀ ▀ ▀▀█▄▀ █▄▄▄   
  ▄▀▀▀▄ ▀ ▀▀▄▀▄▀▀▄█▀ ▀▀▀█▄█ ▄ ▄▀█▀▄▀▀ ▀   
    ██▀▀▀▄ █ █▀█▀▀ ▄ ▄ ██▀ ▀▀▀  █▄█▄█▀▄   
  ▀▀▀▀▀▀▀▀█▀▀ ▀█▄█▄▀▄▀██▀█▄▄▄▄█▀▀▀█ ▀▄    
  █▀▀▀▀▀█ ▄▄█ ▄ ▄███▄▄ ▄ ▀  ▄▄█ ▀ ██▄▄▄   
  █ ███ █ ▀▀▄▀▄▀▀▄██▄ ▄▀█▄█ ▄▄████▀▄█▄▄   
  █ ▀▀▀ █ ▄▄▀█▀█▀▀▄▄▀▄ ████ █ ▄  ▀▄██▄    
  ▀▀▀▀▀▀▀ ▀   ▀▀  ▀▀ ▀▀▀  ▀  ▀   ▀▀ ▀▀▀   
                                          

I (1725) esp_bridge_wifi_prov_mgr: If QR code is not visible, copy paste the below URL in a browser.
https://espressif.github.io/esp-jumpstart/qrcode.html?data={"ver":"v1","name":"PROV_7F0248","username":"wifiprov","pop":"abcd1234","transport":"ble"}
I (1748) main_task: Returned from app_main()

Steps to reproduce the behavior

  1. Use :
  • the latest version of esp-iot-bridge library.
  • esp-idf V5.3.0.
  • ESP32-Ethernet-Kit_V1.2
  1. Open WIFI_ROUTER example from library

  2. Modify the sdkconfig file like this

  3. Flash the code to ESP32-Ethernet-Kit_V1.2

  4. Try to connect to the wifi AP created

Project release version

v1.0.0

System architecture

ARM 64-bit (Apple M1/M2, Raspberry Pi 4/5)

Operating system

MacOS

Operating system version

macOS Sonoma 14.0

Shell

ZSH

Additional context

No response

GuillaumeHupi avatar Nov 06 '24 09:11 GuillaumeHupi

Hello, please check this part in IDF. Could you confirm if this line of code sets the Wi-Fi mode to station mode?

Normally, when compiling the Mesh Lite example, the manager.c file is replaced by another manager.c file located under the Mesh Lite component. This replacement prevents some provisioning logic from conflicting with the core logic of Mesh Lite.

tswen avatar Nov 11 '24 02:11 tswen

Hello,

The wifi station part of my manager.c file located in "esp/v5.3/esp-idf/components/wifi_provisioning/src/manager.c" seems to be the same as the on that you linked :

    /* Start Wi-Fi in Station Mode.
     * This is necessary for scanning to work */
    ret = esp_wifi_set_mode(WIFI_MODE_STA);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "Failed to set Wi-Fi mode to STA");
        goto err;
    }

I'm using the WIFI_ROUTER example from esp-iot-bridge library, not Mesh Lite. I don't know if the behavior is supposed to be the same.

I found a way to make the WIFI_ROUTER example work. Firstly i kept the "Wi-Fi Provisioning over Bluetooth Low Energy." option checked in menuconfig. I provisioned the wifi credentials. So the ESP was able to connect to my wifi router with the provided credentials. But I still couldn't see the ESP'S AP appear, so I couldn't connect to it.

So then I unchecked the "Wi-Fi Provisioning over Bluetooth Low Energy." option. And reflashed my ESP again, and this time I can connect to the ESP AP and the ESP automatically connected to my wifi router with the credentials kept in memory. So using it like this, it woks as expected, but it requires to disable wifi provisionning with BLE.

Do you have any idea on how to make the example work with BLE provisioning activated ?

GuillaumeHupi avatar Nov 12 '24 09:11 GuillaumeHupi

Because idf's manager.c will set the wifi mode to WIFI_MODE_STA during network configuration, the AP is invalid at this time. You can comment out the idf code or add some logs to confirm.

tswen avatar Nov 14 '24 07:11 tswen

Same issue

ioviedodev avatar Jan 13 '25 01:01 ioviedodev