ESP32-S2 based custom board will not connect to some WiFi networks

SamPRedFern
Posts: 3
Joined: Mon Feb 27, 2023 2:24 am

ESP32-S2 based custom board will not connect to some WiFi networks

Postby SamPRedFern » Wed Jan 22, 2025 1:39 am

Hi,

We have an ESP32-S2 based custom PCB which will connect to some WiFi networks but not others. For example, it will connect fine to (at least one) MikroTik and Ubiquiti access point, but will refuse to connect to the a Teltonika RUT360 network. However, the same code flashed onto an ESP32-S2-DevKitM-1 v1.0 (without any recompilation) will connect to the RUT360 hosted network. Performing a WiFi network scan shows that the device can see the RUT360's network with an acceptable signal strength (-31dBm).

We have setup the code to pull out the reason for failure and we get varyingly 201, 205, and 2 on station disconnect events. I have attached a sample log below.

Does anyone have any any advice on what may be causing this. Additionally any next steps or tests to run would be much appreciated.

Thanks,

Sam

Code: Select all

I (16) boot: ESP-IDF v4.4.7 2nd stage bootloader<\r><\n>
I (16) boot: compile time 14:30:55<\r><\n>
I (16) boot: chip revision: v0.0<\r><\n>
I (16) boot.esp32s2: SPI Speed      : 80MHz<\r><\n>
I (19) boot.esp32s2: SPI Mode       : DIO<\r><\n>
I (23) boot.esp32s2: SPI Flash Size : 4MB<\r><\n>
I (26) boot: Enabling RNG early entropy source...<\r><\n>
I (31) boot: Partition Table:<\r><\n>
I (33) boot: ## Label            Usage          Type ST Offset   Length<\r><\n>
I (40) boot:  0 nvs              WiFi data        01 02 00009000 00006000<\r><\n>
I (46) boot:  1 phy_init         RF data          01 01 0000f000 00001000<\r><\n>
I (53) boot:  2 factory          factory app      00 00 00010000 00100000<\r><\n>
I (59) boot: End of partition table<\r><\n>
I (62) esp_image: segment 0: paddr=00010020 vaddr=3f000020 size=16ebch ( 93884) map<\r><\n>
I (89) esp_image: segment 1: paddr=00026ee4 vaddr=3ffc7c60 size=02f94h ( 12180) load<\r><\n>
I (92) esp_image: segment 2: paddr=00029e80 vaddr=40022000 size=06198h ( 24984) load<\r><\n>
I (99) esp_image: segment 3: paddr=00030020 vaddr=40080020 size=7fa7ch (522876) map<\r><\n>
I (204) esp_image: segment 4: paddr=000afaa4 vaddr=40028198 size=0fac0h ( 64192) load<\r><\n>
I (231) boot: Loaded app from partition at offset 0x10000<\r><\n>
I (231) boot: Disabling RNG early entropy source...<\r><\n>
I (240) cpu_start: Unicore app<\r><\n>
I (240) cache: Instruction cache <9>: size 8KB, 4Ways, cache line size 32Byte<\r><\n>
I (241) cpu_start: Pro cpu up.<\r><\n>
I (264) cpu_start: Pro cpu start user code<\r><\n>
I (264) cpu_start: cpu freq: 160000000<\r><\n>
I (264) cpu_start: Application information:<\r><\n>
I (264) cpu_start: Project name:     wandlink<\r><\n>
I (268) cpu_start: App version:      a22b884-dirty<\r><\n>
I (273) cpu_start: Compile time:     Jan 22 2025 14:30:36<\r><\n>
I (278) cpu_start: ELF file SHA256:  cda7ffa29175559e...<\r><\n>
I (283) cpu_start: ESP-IDF:          v4.4.7<\r><\n>
I (287) cpu_start: Min chip rev:     v0.0<\r><\n>
I (290) cpu_start: Max chip rev:     v1.99 <\r><\n>
I (294) cpu_start: Chip rev:         v0.0<\r><\n>
I (298) heap_init: Initializing. RAM available for dynamic allocation:<\r><\n>
I (304) heap_init: At 3FFCF870 len 0002C790 (177 KiB): DRAM<\r><\n>
I (310) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM<\r><\n>
I (315) heap_init: At 3FF9E000 len 00002000 (8 KiB): RTCRAM<\r><\n>
I (321) spi_flash: detected chip: generic<\r><\n>
I (324) spi_flash: flash io: dio<\r><\n>
I (331) cpu_start: Starting scheduler on PRO CPU.<\r><\n>
I (332) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (332) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (342) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (352) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (362) gpio: GPIO[40]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (372) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (382) gpio: GPIO[17]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (382) gpio: GPIO[34]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (392) gpio: GPIO[33]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (402) gpio: GPIO[35]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (412) gpio: GPIO[45]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (422) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (432) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 <\r><\n>
I (432) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 <\r><\n>
I (462) wifi:wifi driver task: 3ffdae90, prio:23, stack:6656, core=0<\r><\n>
I (462) system_api: Base MAC address is not set<\r><\n>
I (462) system_api: read default base MAC address from EFUSE<\r><\n>
I (472) wifi:wifi firmware version: 1fd20f4<\r><\n>
I (472) wifi:wifi certification version: v7.0<\r><\n>
I (472) wifi:config NVS flash: enabled<\r><\n>
I (472) wifi:config nano formating: disabled<\r><\n>
I (482) wifi:Init data frame dynamic rx buffer num: 32<\r><\n>
I (482) wifi:Init static rx mgmt buffer num: 5<\r><\n>
I (482) wifi:Init management short buffer num: 32<\r><\n>
I (492) wifi:Init dynamic tx buffer num: 32<\r><\n>
I (492) wifi:Init static rx buffer size: 1600<\r><\n>
I (502) wifi:Init static rx buffer num: 10<\r><\n>
I (502) wifi:Init dynamic rx buffer num: 32<\r><\n>
I (512) wifi_init: tcpip mbox: 32<\r><\n>
I (512) wifi_init: udp mbox: 6<\r><\n>
I (512) wifi_init: tcp mbox: 6<\r><\n>
I (512) wifi_init: tcp tx win: 5760<\r><\n>
I (522) wifi_init: tcp rx win: 5760<\r><\n>
I (522) wifi_init: tcp mss: 1440<\r><\n>
I (522) wifi_init: WiFi IRAM OP enabled<\r><\n>
I (532) wifi_init: WiFi RX IRAM OP enabled<\r><\n>
I (532) Wifi: SSID: [REMOVED FOR POSTING]<\r><\n>
I (532) Wifi: PASSWORD: 12345678<\r><\n>
I (542) Wifi: AuthMode Thresh: 0<\r><\n>
I (542) phy_init: phy_version 2401,2a6dc26,Sep 26 2023,11:22:15<\r><\n>
I (582) wifi:mode : sta (7c:df:a1:9a:23:2c)<\r><\n>
I (582) wifi:enable tsf<\r><\n>
I (592) WiFi: wifi_init_sta finished.<\r><\n>
I (2162) Wifi: Reason for Fail: 201<\r><\n>
I (2162) WiFi: retry to connect to the AP<\r><\n>
I (2162) WiFi: connect to the AP fail<\r><\n>
I (3742) Wifi: Reason for Fail: 201<\r><\n>
I (3742) WiFi: retry to connect to the AP<\r><\n>
I (3742) WiFi: connect to the AP fail<\r><\n>
I (5312) Wifi: Reason for Fail: 201<\r><\n>
I (5312) WiFi: retry to connect to the AP<\r><\n>
I (5312) WiFi: connect to the AP fail<\r><\n>
I (5942) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1<\r><\n>
I (5942) wifi:state: init -> auth (b0)<\r><\n>
I (6942) wifi:state: auth -> init (200)<\r><\n>
I (6952) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1<\r><\n>
I (6952) Wifi: Reason for Fail: 2<\r><\n>
I (6952) WiFi: retry to connect to the AP<\r><\n>
I (6952) WiFi: connect to the AP fail<\r><\n>
I (8532) Wifi: Reason for Fail: 205<\r><\n>
I (8532) WiFi: retry to connect to the AP<\r><\n>
I (8532) WiFi: connect to the AP fail<\r><\n>
I (9222) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1<\r><\n>
I (9222) wifi:state: init -> auth (b0)<\r><\n>
I (10222) wifi:state: auth -> init (200)<\r><\n>
I (10222) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1<\r><\n>
I (10222) Wifi: Reason for Fail: 2<\r><\n>
I (10222) WiFi: retry to connect to the AP<\r><\n>
I (10232) WiFi: connect to the AP fail<\r><\n>
I (11802) Wifi: Reason for Fail: 201<\r><\n>
I (11802) WiFi: retry to connect to the AP<\r><\n>
I (11802) WiFi: connect to the AP fail<\r><\n>
I (13382) Wifi: Reason for Fail: 201<\r><\n>
I (13382) WiFi: retry to connect to the AP<\r><\n>
I (13382) WiFi: connect to the AP fail<\r><\n>


SamPRedFern
Posts: 3
Joined: Mon Feb 27, 2023 2:24 am

Re: ESP32-S2 based custom board will not connect to some WiFi networks

Postby SamPRedFern » Wed Jan 22, 2025 7:50 pm

I found and fixed the issue! I rechecked the BOM of our board and we had used a ±20ppm crystal for our 40MHz clock source. Switching this to ±10ppm crystal as is required (hardware design guide, section 3.5.1) resolved the issue immediately and the board connected to the RUT360's WiFi network as expected.

ESP_Sprite
Posts: 9882
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S2 based custom board will not connect to some WiFi networks

Postby ESP_Sprite » Thu Jan 23, 2025 2:42 pm

Thanks for posting the solution! And yep, an 10ppm crystal is needed.

Who is online

Users browsing this forum: No registered users and 38 guests