esp_wifi_init() fails on ESP32-S2 WROVER; works on WROOM? (SOLVED)
Posted: Wed Feb 17, 2021 3:19 am
I have WI-FI STA and AP code working properly on an ESP32-S2 WROOM, but when I run it on a WROVER with the external RAM enabled, esp_wifi_init() fails with ESP_ERR_NO_MEM.
The startup code for AP mode:
Failure mode on a WROVER (an ESP32-S2-Saola-R1) with external RAM enabled in menuconfig:
The startup code for AP mode:
Code: Select all
ESP_ERROR_CHECK(esp_event_loop_create_default());
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
ESP_EVENT_ANY_ID,
&event_handler,
NULL,
NULL));
if (!_initialized) {
ESP_LOGI(TAG, "esp_netif_init()");
ESP_ERROR_CHECK(esp_netif_init());
} // if !_initialized
_espNetif = esp_netif_create_default_wifi_ap();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg)); // THIS IS THE LINE WHERE IT FAILS!
wifi_country_t country = { "US", 1, 11, 0, WIFI_COUNTRY_POLICY_AUTO };
ESP_ERROR_CHECK(esp_wifi_set_country(&country));
// etc: set mode, set config, start, start mdns, start http server...
If I run on a WROOM (ESP32-S2-Saola-M1), or I disable "Support for external, SPI-connected RAM" in menuconfig on the WROVER, Wi-Fi initializes and runs:I (20035) wifi_init: rx ba win: 6
I (20035) wifi_init: tcpip mbox: 32
I (20035) wifi_init: udp mbox: 6
I (20035) wifi_init: tcp mbox: 6
I (20035) wifi_init: tcp tx win: 5744
I (20045) wifi_init: tcp rx win: 5744
I (20045) wifi_init: tcp mss: 1440
I (20055) wifi_init: WiFi IRAM OP enabled
I (20055) wifi_init: WiFi RX IRAM OP enabled
ESP_ERROR_CHECK failed: esp_err_t 0x101 (ESP_ERR_NO_MEM) at 0x4002ba70
0x4002ba70: _esp_error_check_failed at /Users/adamwilt/esp/esp-idf/components/esp_common/src/esp_err.c:41
file: "../components/dcr_wifi/dcr_wifi.c" line 250
func: wifi_ap_start
expression: esp_wifi_init(&cfg)
abort() was called at PC 0x4002ba73 on core 0
What do I need to do differently to init Wi-Fi on a WROVER with external RAM?I (19664) wifi_init: rx ba win: 6
I (19674) wifi_init: tcpip mbox: 32
I (19674) wifi_init: udp mbox: 6
I (19674) wifi_init: tcp mbox: 6
I (19684) wifi_init: tcp tx win: 5744
I (19684) wifi_init: tcp rx win: 5744
I (19694) wifi_init: tcp mss: 1440
I (19694) wifi_init: WiFi IRAM OP enabled
I (19704) wifi_init: WiFi RX IRAM OP enabled
I (19704) wifi:set country: cc=US schan=1 nchan=11 policy=0
I (19714) phy_init: phy_version 1300,2887b9c,Dec 16 2020
I (19844) wifi:mode : softAP (7c:df:a1:05:d6:5b)
I (19844) wifi:Total power save buffer number: 8
I (19844) wifi:Init max length of beacon: 752/752
I (19844) wifi:Init max length of beacon: 752/752
I (19854) dcr_wifi: eventHandler ignoring event
I (19864) dcr_wifi: wifi_init_softap finished. SSID:DCR_II password: channel:10
I (19864) dcr_wifi: Starting mDNS service...