Getting this error "E (762367) esp_netif_lwip: esp_netif_new: Failed to configure netif with config=0x3fce53b4 (config o
Posted: Thu Nov 17, 2022 5:08 am
I am relatively new to ESP32 and network programming.
I am running an ESP32S3 chip. I want to be able to scan all packets coming in and then connect to an access point to send a report to a url and then resume scanning.
It is pretty much working but I get this error when going to the access point.
E (762367) esp_netif_lwip: esp_netif_new: Failed to configure netif with config=0x3fce53b4 (config or if_key is NULL or duplicate key)
Below is the code in setup() to initialize the scan.
Everything is working fine. No errors and I am getting the packets.
Now I want to connect to an access point and this is the code I run.
I do get error 0x3002 when I call esp_wifi_disconnect(). ESP_ERR_WIFI_NOT_STARTED (0x3002): WiFi driver was not started by esp_wifi_start so maybe I need to call something else to stop the driver. Not sure what to call to do this.
I put the delay in just to give things time.
I now connect to the network with this code
So far so good.
Now in the loop() code I have
The code does appear to work as I am going out to the Internet and getting the web page. However, the error is concerning and sometimes it appears the chip does get confused and I have to call stopHttpNetwork() several times as well as initializeScanning()
I assume I should be doing something else when I shut down the scanning to free up some memory or resources but I don't know what to call to do it.
Any help would be greatly appreciated.
Thanks
I am running an ESP32S3 chip. I want to be able to scan all packets coming in and then connect to an access point to send a report to a url and then resume scanning.
It is pretty much working but I get this error when going to the access point.
E (762367) esp_netif_lwip: esp_netif_new: Failed to configure netif with config=0x3fce53b4 (config or if_key is NULL or duplicate key)
Below is the code in setup() to initialize the scan.
Code: Untitled.c Select all
nvs_flash_init();
tcpip_adapter_init();
esp_event_loop_init(event_handler, NULL);
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
esp_wifi_init(&cfg);
esp_wifi_set_storage(WIFI_STORAGE_RAM);
esp_wifi_set_mode(WIFI_MODE_NULL);
esp_wifi_start();
esp_wifi_set_promiscuous(true);
esp_wifi_set_promiscuous_rx_cb(&callback);
esp_wifi_set_channel(6, WIFI_SECOND_CHAN_NONE);
Now I want to connect to an access point and this is the code I run.
Code: Untitled.c Select all
printf("Stopping Scanning \r\n");
esp_err_t errorNumber;
errorNumber = esp_wifi_stop();
printf("errorNumber: %x \r\n", (int) errorNumber);
errorNumber = esp_wifi_disconnect();
printf("errorNumber: %x \r\n", (int) errorNumber); // Getting error 0x3002
errorNumber = esp_wifi_deinit();
printf("errorNumber: %x \r\n", (int) errorNumber);
esp_netif_init();
esp_wifi_restore();
delay(5000);
I put the delay in just to give things time.
I now connect to the network with this code
Code: Untitled.c Select all
wifiMulti.addAP("NetworkIWantToConnectTo", "password");
delay(5000);
httpUrl = "www.whereIwantToGoTo.com";
Now in the loop() code I have
Code: Untitled.c Select all
if (strlen(httpUrl) > 0)
{
int rc = wifiMulti.run(); // This is the line where I am getting the error
if ((rc == WL_CONNECTED)) {
printf("wifiMulti is connected \r\n");
HTTPClient http;
Serial.print("[HTTP] begin...\n");
// configure traged server and url
printf("Going out to %s \r\n", httpUrl);
http.begin(httpUrl);
Serial.print("[HTTP] GET...\n");
// start connection and send HTTP header
int httpCode = http.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTP] GET... code: %d\n", httpCode);
} else {
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
httpDataReceived = true;
strcpy(httpUrl, "");
http.end();
stopHttpNetwork();
//delay(5000);
initializeScanning();
}
Code: Untitled.c Select all
void stopHttpNetwork()
{
esp_wifi_disconnect();
delay(5000);
printf("Just disconnected from Internet\r\n");
return;
}
void initializeScanning()
{
printf("Initializing Remote ID Scanning \r\n");
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
esp_wifi_init(&cfg);
esp_wifi_set_storage(WIFI_STORAGE_RAM);
esp_wifi_set_mode(WIFI_MODE_NULL);
esp_wifi_start();
esp_wifi_set_promiscuous(true);
esp_wifi_set_promiscuous_rx_cb(&callback);
esp_wifi_set_channel(6, WIFI_SECOND_CHAN_NONE);
return;
}
Any help would be greatly appreciated.
Thanks