Open EricNRS opened 2 weeks ago
Doing a bit more debugging, the issue is that the ESP32-S3 WiFi stack does not support buffers allocated in SPIRAM and the minimum heap size of 51200 is too small, so the heap manager starts allocating out of SPIRAM.
*** Booting Zephyr OS build v3.6.0-5736-gd78a9429450f ***
uart:~$ kernel heap
free: 12
allocated: 50904
max. allocated: 50904
Increasing the heap size to 100KB allows the scan to work and shows that the maximum heap usage is 83400 bytes.
uart:~$ kernel heap
free: 21068
allocated: 80892
max. allocated: 83400
The HEAP_MEM_POOL_ADD_SIZE_BOARD
should be increased to 86016 or similar to allow WiFi to work.
However, this increased memory requirement makes the ESP32-S3 target very difficult to use since the internal SRAM is already in short supply with just this example already using 73% of the available memory. Is there any chance that the ESP32-S3 WiFi stack could be fixed to support using buffers from SPIRAM? That has been a long-term issue.
Memory region Used Size Region Size %age Used
FLASH: 603244 B 8388352 B 7.19%
iram0_0_seg: 68148 B 329 KB 20.23%
dram0_0_seg: 234376 B 313 KB 73.13%
irom0_0_seg: 341706 B 8 MB 4.07%
drom0_0_seg: 472172 B 8 MB 5.63%
ext_ram_seg: 1536 KB 8388544 B 18.75%
rtc_iram_seg: 0 GB 8 KB 0.00%
rtc_data_seg: 0 GB 8 KB 0.00%
rtc_slow_seg: 0 GB 8 KB 0.00%
IDT_LIST: 0 GB 8 KB 0.00%
@sylvioalves
Describe the bug If SPIRAM is enabled, WiFi does not work on ESP32S3 WROOM N16R8.
WiFi Works if SPIRAM is disabled:
west build --pristine -b xiao_esp32s3/esp32s3/procpu samples/net/wifi -DCONFIG_ESP_SPIRAM=n && west flash && west espressif monitor
If SPIRAM is enabled, then WiFi returns nothing for
wifi scan
and will also not connect. I only have octal SPI devices, so I am unable to determine if this is just an octal SPI issue or it it applies to quad SPI as well.west build --pristine -b xiao_esp32s3/esp32s3/procpu samples/net/wifi -DCONFIG_ESP_SPIRAM=y -DCONFIG_SPIRAM_MODE_OCT=y && west flash && west espressif monitor
To Reproduce Steps to reproduce the behavior:
west build --pristine -b xiao_esp32s3/esp32s3/procpu samples/net/wifi -DCONFIG_ESP_SPIRAM=y -DCONFIG_SPIRAM_MODE_OCT=y && west flash && west espressif monitor
Expected behavior WiFi scan finds access points and allows connecting.
Impact Complete failure of WiFi
Environment (please complete the following information): Zephyr 3.6.99 main @ d78a9429450f89de7829c8af7efe41fdb692fd50