espressif / esp-idf

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

[MESH][v5.1.2]: Issue WIFI_REASON_ASSOC_TOOMANY when connect 20 Devices same range with Root Device (IDFGH-11845) #12934

Closed andy-danieal closed 8 months ago

andy-danieal commented 8 months ago

Answers checklist.

General issue report

With ESP-WIFI-MESH, we have used the "No-Router" setting and the "Fixed Root" device. However, I noticed that some random two or three devices had been disconnected. Even after restarting, the issue persists. In contrast, when only three devices are connected, all devices are successfully connected.


Topology = MESH_TOPO_TREE
Max_layer = 15,              
Channel = 11,                
AP mode = WIFI_AUTH_WPA2_PSK,
AP max connection = 8
nonmesh_max_connection = 2
AP mesh password = "TEST@DANW!F|",

`ESP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0x1 (POWERON),boot:0xa (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3ffe6108,len:0x183c load:0x4004b000,len:0x4 load:0x4004b004,len:0xab4 load:0x4004f000,len:0x31b0 entry 0x4004b1c4 I (23) boot: ESP-IDF v5.1.2-dirty 2nd stage bootloader I (24) boot: compile time Dec 13 2023 11:22:36 I (24) boot: chip revision: v1.0 I (28) boot.esp32s2: SPI Speed : 80MHz I (32) boot.esp32s2: SPI Mode : DIO I (37) boot.esp32s2: SPI Flash Size : 4MB I (42) boot: Enabling RNG early entropy source... I (47) boot: Partition Table: I (51) boot: ## Label Usage Type ST Offset Length I (58) boot: 0 nvs WiFi data 01 02 0000d000 00004000 I (66) boot: 1 otadata OTA data 01 00 00011000 00002000 I (73) boot: 2 phy_init RF data 01 01 00013000 00001000 I (81) boot: 3 edf Custom data 01 02 00014000 00004000 I (88) boot: 4 storage Unknown data 01 81 00018000 00020000 I (95) boot: 5 ota_0 OTA app 00 10 00040000 00170000 I (103) boot: 6 ota_1 OTA app 00 11 001b0000 00170000 I (111) boot: End of partition table I (115) esp_image: segment 0: paddr=00040020 vaddr=3f000020 size=2d45ch (185436) map I (160) esp_image: segment 1: paddr=0006d484 vaddr=3ffc9210 size=02b94h ( 11156) load I (163) esp_image: segment 2: paddr=00070020 vaddr=40080020 size=b27b0h (731056) map I (312) esp_image: segment 3: paddr=001227d8 vaddr=3ffcbda4 size=0108ch ( 4236) load I (313) esp_image: segment 4: paddr=0012386c vaddr=40024000 size=15210h ( 86544) load I (350) boot: Loaded app from partition at offset 0x40000 I (350) boot: Disabling RNG early entropy source... I (362) cpu_start: Unicore app I (362) cache: Instruction cache : size 8KB, 4Ways, cache line size 32Byte I (364) cache: Data cache : size 8KB, 4Ways, cache line size 32Byte I (371) cpu_start: Pro cpu up. I (394) cpu_start: Pro cpu start user code I (394) cpu_start: cpu freq: 160000000 Hz I (394) cpu_start: Application information: I (402) cpu_start: App version: 04763cb-dirty I (407) cpu_start: Compile time: Dec 21 2023 19:45:41 I (413) cpu_start: ELF file SHA256: 2b81259c1d8e2a74... I (419) cpu_start: ESP-IDF: v5.1.2-dirty I (425) cpu_start: Min chip rev: v0.0 I (429) cpu_start: Max chip rev: v1.99 I (434) cpu_start: Chip rev: v1.0 I (439) heap_init: Initializing. RAM available for dynamic allocation: I (446) heap_init: At 3FFD4078 len 00027F88 (159 KiB): DRAM I (452) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM I (458) heap_init: At 3FF9E000 len 00001FE8 (7 KiB): RTCRAM I (466) spi_flash: detected chip: generic I (469) spi_flash: flash io: dio I (474) coexist: coex firmware version: b6d5e8c I (479) app_start: Starting scheduler on CPU0 I (00:00:00.090) main_task: Started on CPU0 I (00:00:00.095) main_task: Calling app_main() I (00:00:00.110) wearleveling_helper: Mounting FAT filesystem I (992) wifi:wifi driver task: 3ffe05b8, prio:23, stack:6656, core=0 I (1004) wifi:wifi firmware version: 91b9630 I (1004) wifi:wifi certification version: v7.0 I (1005) wifi:config NVS flash: enabled I (1008) wifi:config nano formating: disabled I (1012) wifi:Init data frame dynamic rx buffer num: 32 I (1017) wifi:Init static rx mgmt buffer num: 5 I (1021) wifi:Init management short buffer num: 32 I (1025) wifi:Init dynamic tx buffer num: 128 I (1030) wifi:Init static rx buffer size: 1600 I (1034) wifi:Init static rx buffer num: 10 I (1037) wifi:Init dynamic rx buffer num: 32 I (00:00:00.437) wifi_init: tcpip mbox: 32 I (00:00:00.441) wifi_init: udp mbox: 6 I (00:00:00.445) wifi_init: tcp mbox: 6 I (00:00:00.450) wifi_init: tcp tx win: 5744 I (00:00:00.455) wifi_init: tcp rx win: 5744 I (00:00:00.460) wifi_init: tcp mss: 1440 I (00:00:00.464) wifi_init: WiFi IRAM OP enabled I (00:00:00.470) wifi_init: WiFi RX IRAM OP enabled I (00:00:00.476) phy_init: phy_version 2401,2a6dc26,Sep 26 2023,11:22:15 I (1131) wifi:mode : sta (a0:76:4e:8c:ee:8a) + softAP (a0:76:4e:8c:ee:8b) I (1131) wifi:enable tsf I (1135) wifi:Total power save buffer number: 64 I (1136) wifi:Init max length of beacon: 752/752 I (1138) wifi:Init max length of beacon: 752/752 I (1153) wifi:Set ps type: 0, coexist: 0

W (1161) wifi:Affected by the ESP-NOW encrypt num, set the max connection num to 1 I (1169) wifi:Total power save buffer number: 64 I (00:00:00.987) [MESH-EVENT]: ID:56:49:42:45:00:00 I (00:00:00.988) [MESH-EVENT]: Mesh starts successfully. I (00:00:00.991) [MESH-EVENT]: Mesh ID: 56:49:42:45:00:00 I (00:00:00.999) [MESH-EVENT]: Mesh type: Node I (00:00:01.007) [MESH-EVENT]: Channel: 11 I (00:00:01.015) [MESH-EVENT]: Max. connected stations: 8 I (00:00:01.023) [MESH-EVENT]: STA protocol: I (00:00:01.030) [MESH-EVENT]: AP protocol: I (00:00:01.037) [MESH-EVENT]: Max. layer: 15 I (00:00:01.046) [MESH-EVENT]: Topology: Tree I (00:00:01.053) [MESH-EVENT]: Root fixed: Yes I (00:00:01.061) [MESH-EVENT]: Power save enabled: No I (00:00:01.069) [MESH-EVENT]: Max. TX power: 19.5 dBm I (00:00:01.078) [MESH-EVENT]: Free heap: 53504 I (2716) wifi:new:<11,2>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (3129) wifi:state: init -> auth (b0) I (3145) wifi:state: auth -> init (5c0) I (3146) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:02.542) [MESH-EVENT]: reason:5 I (4262) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (4683) wifi:state: init -> auth (b0) I (4700) wifi:state: auth -> init (5c0) I (4701) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:04.098) [MESH-EVENT]: reason:5 I (5863) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (6283) wifi:state: init -> auth (b0) I (6331) wifi:state: auth -> init (5c0) I (6332) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:05.729) [MESH-EVENT]: reason:5 W (6472) wifi:scan number is 0 W (6595) wifi:scan number is 0 W (6717) wifi:scan number is 0 I (7814) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (8235) wifi:state: init -> auth (b0) I (8262) wifi:state: auth -> init (5c0) I (8263) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:07.659) [MESH-EVENT]: reason:5 I (00:00:09.346) [MESH-EVENT]: reason:201 I (11408) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (11829) wifi:state: init -> auth (b0) I (11836) wifi:state: auth -> init (5c0) I (11837) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:11.245) [MESH-EVENT]: reason:5 I (12934) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (13355) wifi:state: init -> auth (b0) I (13382) wifi:state: auth -> init (5c0) I (13383) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:12.779) [MESH-EVENT]: reason:5 I (14503) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (14915) wifi:state: init -> auth (b0) I (14932) wifi:state: auth -> init (5c0) I (14933) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:14.330) [MESH-EVENT]: reason:5 I (16091) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (16573) wifi:state: init -> auth (b0) I (16590) wifi:state: auth -> init (5c0) I (16591) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:15.988) [MESH-EVENT]: reason:5 W (16853) wifi:scan number is 0 W (16976) wifi:scan number is 0 I (18053) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (18536) wifi:state: init -> auth (b0) I (18576) wifi:state: auth -> init (5c0) I (18577) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:17.973) [MESH-EVENT]: reason:5 I (19600) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (20021) wifi:state: init -> auth (b0) I (20038) wifi:state: auth -> init (5c0) I (20039) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:19.436) [MESH-EVENT]: reason:5 I (21222) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (21643) wifi:state: init -> auth (b0) I (21693) wifi:state: auth -> init (5c0) I (21694) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:21.091) [MESH-EVENT]: reason:5 W (22019) wifi:scan number is 0 I (23270) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (23683) wifi:state: init -> auth (b0) I (23707) wifi:state: auth -> init (5c0) I (23707) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:23.104) [MESH-EVENT]: reason:5 W (24031) wifi:scan number is 0 W (24153) wifi:scan number is 0 I (25222) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (25643) wifi:state: init -> auth (b0) I (25672) wifi:state: auth -> init (5c0) I (25673) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:25.070) [MESH-EVENT]: reason:5 I (26779) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (27200) wifi:state: init -> auth (b0) I (27220) wifi:state: auth -> assoc (0) I (27231) wifi:state: assoc -> run (10) I (00:00:26.631) [MESH-EVENT]: root address:a0:76:4e:8d:05:55 E (00:00:26.631) [APP_UTILS]: Failed to MESH Network connection. I (27279) wifi:connected with ESPM_8CEECC, aid = 1, channel 11, 40D, bssid = a0:76:4e:8c:ee:cd I (27280) wifi:security: WPA2-PSK, phy: lrbgn, rssi: -74 I (27284) wifi:pm start, type: 0

I (00:00:26.683) [MESH-EVENT]: layer:0-->8, parent:a0:76:4e:8c:ee:cd, ID:56:49:42:45:00:00, duty:0 I (00:00:26.693) [MESH-EVENT]: state:0 I (00:00:26.699) [MESH-EVENT]: root address:a0:76:4e:8d:05:55 I (27812) wifi:AP's beacon interval = 1024000 us, DTIM period = 1 W (60246) wifi:5258parent candidate a0:76:4e:8c:ef:33, candidate_set:1, rssi:-46(threshold:-78), duration:21secs I (60248) wifi:state: run -> init (0) I (60251) wifi:pm stop, total sleep time: 0 us / 32966045 us

I (60256) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:00:59.671) [MESH-EVENT]: reason:8 I (61273) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (61754) wifi:state: init -> auth (b0) I (61771) wifi:state: auth -> init (5c0) I (61772) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:01.169) [MESH-EVENT]: reason:5 I (64322) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (64806) wifi:state: init -> auth (b0) I (64823) wifi:state: auth -> init (5c0) I (64824) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:04.221) [MESH-EVENT]: reason:5 I (66414) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (66827) wifi:state: init -> auth (b0) I (66844) wifi:state: auth -> init (5c0) I (66845) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:06.242) [MESH-EVENT]: reason:5 I (69442) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (69863) wifi:state: init -> auth (b0) I (69880) wifi:state: auth -> init (5c0) I (69881) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:09.278) [MESH-EVENT]: reason:5 W (00:01:09.373) [APP]: Writing Flash... I (00:01:09.374) wearleveling_helper: Writing File: /spiflash/switch-data.txt I (71500) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (71921) wifi:state: init -> auth (b0) I (71938) wifi:state: auth -> init (5c0) I (71939) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:11.336) [MESH-EVENT]: reason:5 I (73549) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (73970) wifi:state: init -> auth (b0) I (73987) wifi:state: auth -> init (5c0) I (73988) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:13.385) [MESH-EVENT]: reason:5 I (75597) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (76018) wifi:state: init -> auth (b0) I (76035) wifi:state: auth -> init (5c0) I (76036) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:15.433) [MESH-EVENT]: reason:5 I (00:01:18.503) [MESH-EVENT]: reason:201 I (79590) wifi:new:<11,2>, old:<11,0>, ap:<11,2>, sta:<11,2>, prof:11 I (80011) wifi:state: init -> auth (b0) I (80073) wifi:state: auth -> init (5c0) I (80074) wifi:new:<11,0>, old:<11,2>, ap:<11,2>, sta:<11,2>, prof:11 I (00:01:19.470) [MESH-EVENT]: reason:5 `

sdkconfig.txt

andy-danieal commented 8 months ago

Any update regrading that issue ?

zhangyanjiaoesp commented 8 months ago

@andy-danieal

W (1161) wifi:Affected by the ESP-NOW encrypt num, set the max connection num to 1

this log indicates the max connection num for SoftAP has been changed to 1 due to EPSNOW, please change the CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM to 0 if you don't need ESP-NOW.

here is the doc : https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/wifi.html#ap-basic-configuration

截屏2024-01-19 15 38 20
andy-danieal commented 8 months ago

Thanks for your replay. And issue has been resolved. But we need ESP-Now also. So, can we use same time?

    ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(app_mesh_config->ap_mode));
    cfg.mesh_ap.max_connection         = 8;
    cfg.mesh_ap.nonmesh_max_connection = 2;
    memcpy((uint8_t *)&cfg.mesh_ap.password, app_mesh_config->ap_password, strlen(app_mesh_config->ap_password));
    ESP_ERROR_CHECK(esp_mesh_set_config(&cfg));
   CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=3
zhangyanjiaoesp commented 8 months ago

Thanks for your replay. And issue has been resolved. But we need ESP-Now also. So, can we use same time?

    ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(app_mesh_config->ap_mode));
    cfg.mesh_ap.max_connection         = 8;
    cfg.mesh_ap.nonmesh_max_connection = 2;
    memcpy((uint8_t *)&cfg.mesh_ap.password, app_mesh_config->ap_password, strlen(app_mesh_config->ap_password));
    ESP_ERROR_CHECK(esp_mesh_set_config(&cfg));
   CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=3

yes, this setting will be ok.