espressif / esp-idf

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

When initializing WiFi AP mode not letting anything connect (IDFGH-11530) #12655

Closed andresragot closed 7 months ago

andresragot commented 11 months ago

Answers checklist.

IDF version.

5.1.1 & 5.1.2

Espressif SoC revision.

ESP32-WROVER-IE

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

CMD

Development Kit.

Custom Board

Power Supply used.

USB

What is the expected behavior?

When declaring and initializing the wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();

and setting the explicit number of connections to the wifi_config_t in here: `esp_wifi_set_mode(WIFI_MODE_AP);

    wifi_config_t wifi_config_ap = { 0 };
    wifi_config_ap.ap.ssid_hidden = 0;
    wifi_config_ap.ap.channel = 0;
    wifi_config_ap.ap.max_connection = 3;
    wifi_config_ap.ap.beacon_interval = 100;
    wifi_config_ap.ap.pmf_cfg.capable = true;
    wifi_config_ap.ap.pmf_cfg.required = true;
    wifi_config_ap.ap.authmode = WIFI_AUTH_WPA2_PSK;
    memset(&wifi_config_ap.ap.ssid, 0, sizeof(wifi_config_ap.ap.ssid) * sizeof(char));
    memset(&wifi_config_ap.ap.password, 0, sizeof(wifi_config_ap.ap.password) * sizeof(char));

    memcpy(wifi_config_ap.ap.ssid, nvs_struct.ap_ssid, strlen(nvs_struct.ap_ssid));
    memcpy(wifi_config_ap.ap.password, nvs_struct.ap_pass, strlen(nvs_struct.ap_pass));
    esp_wifi_set_config(WIFI_IF_AP, &wifi_config_ap);`

gave this error in the CMD running the code in debug. W (1661) wifi:Affected by the ESP-NOW encrypt num, set the max connection num to 0 "FIXED" adding this line of code:

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); cfg.espnow_max_encrypt_num = 0;

What is the actual behavior?

When connecting from another devide it doesn't let you connect. Gives error "Wrong Password" or "Could not connect"

Steps to reproduce.

  1. Step Initialize the wifi_init_config_t with the default values
  2. Step Configure the wifi_config_t starting with everything at 0 and afterwards add all values one by one.
  3. Step Launch and try to connect to the AP

Debug Logs.

spressif/frameworks/esp-idf-v5.1.2 -D SERIAL_TOOL=C:/Espressif/python_env/idf5.3_py3.11_env/Scripts/python.exe;;C:/Espressif/frameworks/esp-idf-v5.1.2/components/esptool_py/esptool/esptool.py;--chip;esp32 -D SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args -D WORKING_DIRECTORY=C:/Users/andre/esp/flowers2/build -P C:/Espressif/frameworks/esp-idf-v5.1.2/components/esptool_py/run_serial_tool.cmake"
Executing action: monitor
Running idf_monitor in directory C:\Users\andre\esp\flowers2
Executing "C:\Espressif\python_env\idf5.3_py3.11_env\Scripts\python.exe C:\Espressif\frameworks\esp-idf-v5.1.2\tools/idf_monitor.py -p COM7 -b 115200 --toolchain-prefix xtensa-esp32-elf- --decode-coredumps info --target esp32 --revision 200 C:\Users\andre\esp\flowers2\build\SingularFlowers.elf --force-color -m 'C:\Espressif\python_env\idf5.3_py3.11_env\Scripts\python.exe' 'C:\Espressif\frameworks\esp-idf-v5.1.2\tools\idf.py'"...
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM7 instead...
--- esp-idf-monitor 1.3.3 on \\.\COM7 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7908
load:0x40078000,len:18872
load:0x40080400,len:4
0x40080400: _init at ??:?

load:0x40080404,len:4488
entry 0x400806d8
I (29) boot: ESP-IDF v5.3-dev-422-ga7fbf452fa 2nd stage bootloader
I (29) boot: compile time Nov 23 2023 12:04:19
I (31) boot: Multicore bootloader
I (35) boot: chip revision: v3.0
I (39) qio_mode: Enabling default flash chip QIO
I (44) boot.esp32: SPI Speed      : 40MHz
I (49) boot.esp32: SPI Mode       : QIO
I (53) boot.esp32: SPI Flash Size : 16MB
I (58) boot: Enabling RNG early entropy source...
I (63) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (74) boot:  0 nvs              WiFi data        01 02 00011000 00080000
I (82) boot:  1 otadata          OTA data         01 00 00091000 00002000
I (89) boot:  2 phy_init         RF data          01 01 00093000 00004000
I (97) boot:  3 factory          factory app      00 00 000a0000 00300000
I (104) boot:  4 ota_0            OTA app          00 10 003a0000 00300000
I (112) boot:  5 ota_1            OTA app          00 11 006a0000 00300000
I (119) boot:  6 pub              Unknown data     01 82 009a0000 00100000
I (127) boot:  7 prv              Unknown data     01 82 00aa0000 00500000
I (134) boot: End of partition table
I (139) boot: Defaulting to factory image
I (143) esp_image: segment 0: paddr=000a0020 vaddr=3f400020 size=27d48h (163144) map
I (152) esp_image: segment 1: paddr=000c7d70 vaddr=3ffb0000 size=0448ch ( 17548) load
I (162) esp_image: segment 2: paddr=000cc204 vaddr=40080000 size=03e14h ( 15892) load
I (170) esp_image: segment 3: paddr=000d0020 vaddr=400d0020 size=9cd18h (642328) map
I (177) esp_image: segment 4: paddr=0016cd40 vaddr=40083e14 size=18198h ( 98712) load
I (196) boot: Loaded app from partition at offset 0xa0000
I (196) boot: Disabling RNG early entropy source...
I (209) cpu_start: Multicore app
I (209) quad_psram: This chip is ESP32-D0WD
I (209) esp_psram: Found 8MB PSRAM device
I (211) esp_psram: Speed: 40MHz
I (215) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
W (222) esp_psram: Virtual address not enough for PSRAM, map as much as we can. 4MB is mapped
I (1088) esp_psram: SPI SRAM memory test OK
I (1096) cpu_start: Pro cpu start user code
I (1096) cpu_start: cpu freq: 240000000 Hz
I (1096) cpu_start: Application information:
I (1100) cpu_start: Project name:     SingularFlowers
I (1105) cpu_start: App version:      1
I (1110) cpu_start: Compile time:     Nov 23 2023 12:04:08
I (1116) cpu_start: ELF file SHA256:  04a5fd721c8e5f8e...
I (1122) cpu_start: ESP-IDF:          v5.3-dev-422-ga7fbf452fa
I (1129) cpu_start: Min chip rev:     v2.0
I (1133) cpu_start: Max chip rev:     v3.99
I (1138) cpu_start: Chip rev:         v3.0
I (1143) heap_init: Initializing. RAM available for dynamic allocation:
I (1150) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1157) heap_init: At 3FFB99D0 len 00026630 (153 KiB): DRAM
I (1163) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1169) heap_init: At 3FFE4350 len 00017CB0 (95 KiB): D/IRAM
I (1176) heap_init: At 4009BFAC len 00004054 (16 KiB): IRAM
I (1182) esp_psram: Adding pool of 4096K of PSRAM memory to heap allocator
I (1190) spi_flash: detected chip: generic
I (1194) spi_flash: flash io: qio
W (1199) i2c: This driver is an old driver, please migrate your application code to adapt `driver/i2c_master.h`
I (1221) main_task: Started on CPU0
I (1231) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1231) main_task: Calling app_main()
W (1231) SF: ****************************************** INITIALIZATION
I (1231) SF: > Configuring Input GPIOs...
I (1241) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (1251) SF: > Configuring Output GPIOs...
I (1251) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1261) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1271) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1281) gpio: GPIO[25]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1291) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1301) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1311) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1321) gpio: GPIO[33]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (1331) SF: > Configuring LEDC (PWM)...
I (1331) SF: > Configuring I2C...
I (1341) SF: > NVS initialization...
I (1521) SF: > Configuring Standard WiFi...
I (1521) SF:    > NetIf initialization...
I (1521) SF:    > Creating Default Event Loop...
I (1531) SF:    > Creating Main Event Loop...
I (1531) SF:    > Reading local MAC Address...
W (1541) SF:            > MAC Address: 90:38:0c:aa:d8:a4
I (1541) SF:    > Creating default WiFi STA...
I (1551) SF:    > Creating default WiFi AP...
I (1551) SF:    > Initializating WiFi...
I (1571) wifi:wifi driver task: 3ffcf0b0, prio:23, stack:6656, core=1
I (1571) wifi:wifi firmware version: 639ccf2
I (1571) wifi:wifi certification version: v7.0
I (1571) wifi:config NVS flash: disabled
I (1571) wifi:config nano formating: disabled
I (1581) wifi:Init data frame dynamic rx buffer num: 20
I (1581) wifi:Init static rx mgmt buffer num: 5
I (1591) wifi:Init management short buffer num: 32
I (1591) wifi:Init static tx buffer num: 10
I (1601) wifi:Init tx cache buffer num: 20
I (1601) wifi:Init static rx buffer size: 2212
I (1601) wifi:Init static rx buffer num: 10
I (1611) wifi:Init dynamic rx buffer num: 20
I (1611) wifi_init: rx ba win: 6
I (1611) wifi_init: tcpip mbox: 32
I (1621) wifi_init: udp mbox: 6
I (1621) wifi_init: tcp mbox: 6
I (1631) wifi_init: tcp tx win: 5744
I (1631) wifi_init: tcp rx win: 5744
I (1631) wifi_init: tcp mss: 1440
I (1641) wifi_init: WiFi/LWIP prefer SPIRAM
I (1641) wifi_init: WiFi IRAM OP enabled
I (1651) SF:    > Starting WiFi...
I (1651) wifi:Set ps type: 0, coexist: 0

I (1661) SF: AP_SSID _SingularFlower_
I (1661) SF: AP_PASS _12345678_
W (1661) wifi:Affected by the ESP-NOW encrypt num, set the max connection num to 0
I (1841) phy_init: phy_version 4780,16b31a7,Sep 22 2023,20:42:16
I (1901) wifi:mode : softAP (90:38:0c:aa:d8:a5)
I (1901) wifi:Total power save buffer number: 5
I (1901) wifi:Init max length of beacon: 752/752
I (1901) wifi:Init max length of beacon: 752/752
W (1911) SF: ****************************************** CORE
I (1911) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.29.1
I (1921) SF: WIFI_EVENT_AP_START
I (1921) SF: > Initializating 8 flowers...
I (1931) SF: > Entering main loop...

More Information.

We have tried in a UNIX system and the same problem. Other ESP32-WROVER-IE chips and the problem is the same.

Xiehanxin commented 10 months ago

hi @andresragot , I try your ap setting in softAP example, sorry i can't reprudoce your issue, could you provide the a minimal reproduce code or clarify if there are other use cases besides AP?

kepler0308 commented 10 months ago

Hello brother,Have you resolved this issue?

Alvin1Zhang commented 7 months ago

Thanks for reporting, will close due to short of feedback, feel free to reopen with more updates.