W (338406) wifi: mem fail : ESP32-WROVER-B

willhelm
Posts: 7
Joined: Sat Jul 13, 2019 4:41 pm

W (338406) wifi: mem fail : ESP32-WROVER-B

Postby willhelm » Sat Jul 13, 2019 5:01 pm

I get the following error when I run a fairly heavy duty network application that is simultaneously acting as an HTTP server and HTTP client when connecting a browser. I am using a WINGONEER T-Koala ESP32 WiFi Bluetooth Module and the latest ESP-IDF pulled from GitHub.

W (338406) wifi: mem fail :
W (338466) wifi: alloc eb len=24 type=3 fail, heap:4140676

The application is ported from a FreeRTOS/lwIP powered ARM platform.

I have tried increasing the wifi ram using "make menuconfig", but all increased wifi memory settings fail immediately when the firmware boots, except for increased dynamic RX buffer, which I now have increased to 48. With this setting, the board boots, but fails with heavy networking.

The following shows the full trace:
ets Jun 8 2016 00:22:57

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:0x3fff0018,len:4
load:0x3fff001c,len:6444
load:0x40078000,len:11700
load:0x40080400,len:6632
entry 0x40080768
I (29) boot: ESP-IDF v4.0-dev-1191-g138c941fa 2nd stage bootloader
I (29) boot: compile time 07:31:32
I (29) boot: Enabling RNG early entropy source...
I (35) boot: SPI Speed : 40MHz
I (39) boot: SPI Mode : DIO
I (43) boot: SPI Flash Size : 4MB
I (47) boot: Partition Table:
I (51) boot: ## Label Usage Type ST Offset Length
I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (65) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (73) boot: 2 factory factory app 00 00 00010000 00200000
I (80) boot: 3 storage Unknown data 01 82 00210000 000f0000
I (88) boot: 4 coredump Unknown data 01 03 00300000 00100000
I (95) boot: End of partition table
I (99) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x4453c (279868) map
I (207) esp_image: segment 1: paddr=0x00054564 vaddr=0x3ffb0000 size=0x03cd4 ( 15572) load
I (214) esp_image: segment 2: paddr=0x00058240 vaddr=0x40080000 size=0x00400 ( 1024) load
I (215) esp_image: segment 3: paddr=0x00058648 vaddr=0x40080400 size=0x079c8 ( 31176) load
I (236) esp_image: segment 4: paddr=0x00060018 vaddr=0x400d0018 size=0xe7270 (946800) map
I (571) esp_image: segment 5: paddr=0x00147290 vaddr=0x40087dc8 size=0x104e0 ( 66784) load
I (614) boot: Loaded app from partition at offset 0x10000
I (614) boot: Disabling RNG early entropy source...
I (615) psram: This chip is ESP32-D0WD
I (620) spiram: Found 64MBit SPI RAM device
I (624) spiram: SPI RAM mode: flash 40m sram 40m
I (629) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (636) cpu_start: Pro cpu up.
I (640) cpu_start: Application information:
I (645) cpu_start: Project name: file_server
I (650) cpu_start: App version: 1
I (655) cpu_start: Compile time: Jul 13 2019 07:31:31
I (661) cpu_start: ELF file SHA256: e6127394acc71fe6...
I (667) cpu_start: ESP-IDF: v4.0-dev-1191-g138c941fa
I (673) cpu_start: Starting app cpu, entry point is 0x40081600
I (0) cpu_start: App cpu up.
I (1565) spiram: SPI SRAM memory test OK
I (1566) heap_init: Initializing. RAM available for dynamic allocation:
I (1567) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (1571) heap_init: At 3FFB61C8 len 00029E38 (167 KiB): DRAM
I (1578) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1584) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1591) heap_init: At 400982A8 len 00007D58 (31 KiB): IRAM
I (1597) cpu_start: Pro cpu start user code
I (1602) spiram: Adding pool of 4078K of external SPI memory to heap allocator
I (1624) spi_flash: detected chip: generic
I (1624) spi_flash: flash io: dio
I (1625) esp_core_dump_flash: Init core dump to flash
I (1637) esp_core_dump_flash: Found partition 'coredump' @ 300000 1048576 bytes
E (1647) esp_core_dump_common: Failed to mmap core dump data (260)!
I (1648) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1656) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (1716) wifi: wifi driver task: 3ffc5c1c, prio:23, stack:3584, core=0
I (1716) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (1716) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (1746) wifi: wifi firmware version: c5c8475
I (1746) wifi: config NVS flash: enabled
I (1746) wifi: config nano formating: disabled
I (1746) wifi: Init dynamic tx buffer num: 32
I (1746) wifi: Init data frame dynamic rx buffer num: 48
I (1756) wifi: Init management frame dynamic rx buffer num: 48
I (1756) wifi: Init management short buffer num: 32
I (1766) wifi: Init static tx buffer num: 32
I (1776) wifi: Init static rx buffer size: 1600
I (1776) wifi: Init static rx buffer num: 10
I (1776) wifi: Init dynamic rx buffer num: 48
I (1786) example_connect: Connecting to dd-wrt...
I (1876) phy: phy_version: 4100, 2a5dd04, Jan 23 2019, 21:00:07, 0, 0
I (1886) wifi: mode : sta (b4:e6:2d:df:63:01)
I (3096) wifi: new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1
I (4196) wifi: state: init -> auth (b0)
I (4196) wifi: state: auth -> assoc (0)
I (4206) wifi: state: assoc -> run (10)
I (4216) wifi: connected with dd-wrt, channel 11, HT20, bssid = c4:6e:1f:7f:53:be
I (4216) wifi: pm start, type: 1

I (5196) tcpip_adapter: sta ip: 192.168.1.175, mask: 255.255.255.0, gw: 192.168.1.1
I (5196) example_connect: Connected to dd-wrt
I (5196) example_connect: IPv4 address: 192.168.1.175
I (5206) Server: Initializing SPIFFS
I (5306) Server: Partition size: total: 896321, used: 0
Available Heap Space: 4328432
Server listening on IPv4 port 80
Secure server listening on IPv4 port 443

-- after connecting browser

W (23856) wifi: alloc eb len=36 type=3 fail, heap:4120708

W (23856) wifi: mem fail
W (24316) wifi: alloc eb len=24 type=3 fail, heap:4099264

W (24326) wifi: m f null


willhelm
Posts: 7
Joined: Sat Jul 13, 2019 4:41 pm

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby willhelm » Mon Jul 15, 2019 3:51 pm

Not working:

Output:
I (1793) wifi: wifi firmware version: c5c8475
I (1793) wifi: config NVS flash: enabled
I (1793) wifi: config nano formating: disabled
I (1793) wifi: Init dynamic tx buffer num: 32
I (1793) wifi: Init data frame dynamic rx buffer num: 90
I (1803) wifi: Init management frame dynamic rx buffer num: 90
I (1813) wifi: Init management short buffer num: 32
I (1813) wifi: Init static tx buffer num: 64
W (1823) wifi: esf_buf_setup: alloc eb fail
I (1823) wifi: Deinit lldesc rx mblock:0
I (1823) wifi: Deinit lldesc rx mblock:0
I (1833) wifi: Deinit lldesc rx mblock:0
ESP_ERROR_CHECK failed: esp_err_t 0x101 (ESP_ERR_NO_MEM) at 0x40091970

SPI settings:
CONFIG_ESP32_SPIRAM_SUPPORT=y
CONFIG_SPIRAM_BOOT_INIT=y
# CONFIG_SPIRAM_USE_MEMMAP is not set
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_TYPE_AUTO=y
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
CONFIG_SPIRAM_SIZE=-1
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=262144
#CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y

willhelm
Posts: 7
Joined: Sat Jul 13, 2019 4:41 pm

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby willhelm » Mon Jul 15, 2019 4:27 pm

Whatever I do, the wifi memory always fails.

For crying out loud, There's 8Mb on this board, and there's no easy way to configure a high speed TCP app with lots of socket connections?

Can someone send me a configuration file that is sufficient for sustaining 200 simultaneous socket connections at full speed.

jerome
Posts: 37
Joined: Wed Jan 23, 2019 2:28 pm

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby jerome » Mon Sep 02, 2019 10:23 am

Hi
I'm facing a similar issue, WIFI memory allocation always fails.
I was wondering how did you solve your issue ?
Thanks
Jerome

willhelm
Posts: 7
Joined: Sat Jul 13, 2019 4:41 pm

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby willhelm » Tue Sep 03, 2019 6:23 pm

I am waiting for Espressif to fix their SDK :(

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

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby ESP_Sprite » Thu Sep 05, 2019 3:10 am

200 connections at full speed... to be honest, I think that's a fair bit outside of the normal use case for our chips. I'm not 100% sure as I'm not a WiFi guy, but he thing with WiFi and other connections is that the memory they need isn't all capable of being allocated in external memory, as the ESP32 does not support DMA to external memory and has some other restrictions as well. Can I ask what you're trying to do here? If it's a good use case, I can see if I can ask the networking guys for some hints or improvements.

willhelm
Posts: 7
Joined: Sat Jul 13, 2019 4:41 pm

Re: W (338406) wifi: mem fail : ESP32-WROVER-B

Postby willhelm » Sun Sep 08, 2019 4:47 pm

I am looking into the possibility of using the chip as a low cost industrial connectivity bridge to cloud, where PLC's would be connected locally and the chip securely handles the communication with the cloud.

The more connections the chip can handle, the merrier and 200 connections would be awesome, 100 would be good, and 50 would be borderline doable.

Who is online

Users browsing this forum: No registered users and 62 guests