Cannot initialize ESP-AT Lib

Summary: Getting error “Cannot initialize ESP-AT Lib!” when using Wifi HTTP or HTTPS examples from the Wiki at https://wiki.seeedstudio.com/Wio-Terminal-Wi-Fi/ . An older version of the ESP-AT Library works but the current version on Github doesn’t.

Description:

I’ve been using the WIO Terminal with Wifi for some time and it always connects to the network and to the webserver just fine.

But today I installed Arduino on a different computer and downloaded all the libraries I needed from Github. Now when I run the WIFI example I get the error “Cannot initialize ESP-AT Lib”.

If I use a previous release of the ESP-AT Library it works fine. But the current release on Github doesn’t.

I would have posted this in the “issues” section on Github but it looks like it has been disabled.

Hi @Dennis_Mabrey

I just tested with the latest esp-at lib and seems to be working fine on my end

Which verison of esp-at lib you are using, let me recreate this

Hi. I have the same problem using the develop branch of the library. The WiFiScan example works (as you have shown here) but anything that actually connects to a network (e.g. SimpleWiFiServer) fails with the following sort of output in the serial monitor (I haven’t managed to find a version of the esp-at library that works for me):

09:41:41.739 -> Device reset detected!
09:41:45.414 -> Cannot initialize ESP-AT Lib!
09:41:52.539 -> [E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
09:41:52.539 -> 
09:41:53.044 -> Connecting to WiFi..
09:41:53.525 -> Connecting to WiFi..
09:41:54.035 -> Connecting to WiFi..
09:41:54.510 -> Connecting to WiFi..
09:41:55.017 -> Connecting to WiFi..
09:41:55.525 -> Connecting to WiFi..
09:41:56.027 -> Connecting to WiFi..
09:41:56.507 -> Connecting to WiFi..
09:41:57.016 -> Connecting to WiFi..
09:41:57.531 -> Connecting to WiFi..
09:41:58.010 -> Connecting to WiFi..
09:41:58.514 -> Connecting to WiFi..
09:41:59.017 -> Connecting to WiFi..
09:41:59.523 -> Connecting to WiFi..
09:42:00.030 -> Connecting to WiFi..
09:42:00.501 -> Connecting to WiFi..
09:42:00.838 -> [E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
09:42:00.838 -> 
09:42:01.008 -> Connecting to WiFi..
09:42:01.515 -> Connecting to WiFi..
09:42:02.021 -> Connecting to WiFi..
09:42:02.021 -> Connected to the WiFi network
09:42:02.021 -> IP Address: [E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
09:42:02.595 -> 
09:42:03.821 -> 68.3.0.32

This was generated by this sketch:

#include "AtWiFi.h"
 
const char* ssid = "xxxx";
const char* password =  "xxxx";
 
void setup() {
    Serial.begin(115200);
    while(!Serial); // Wait for Serial to be ready
    delay(1000);
 
    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(2000);
 
    WiFi.begin(ssid, password);
 
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.println("Connecting to WiFi..");
    }
    Serial.println("Connected to the WiFi network");
    Serial.print("IP Address: ");
    Serial.println (WiFi.localIP()); // prints out the device's IP address
    }
 
void loop() {
 
}

I was using the developer release from here https://github.com/Seeed-Studio/esp-at-lib. It was from commit 1bf13e4.

All the libraries I used were from the links from the wiki network page form here https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/

I used this library before and it just recently started having this problem. As a temporary solution try downloading from the last May 08,2020 commit. It should work ok as a temp solution.

So I rolled back esp-at to 8th May and that caused errors in atUnified and atWiFi. So I rolled those back to 8th May as well and finally it worked. Thanks @Dennis_Mabrey for the pointer in the right direction - I’m very pleased my brand new Wio Terminal can now connect to wifi.

16:40:41.143 -> Connecting to WiFi..
16:40:41.650 -> Connecting to WiFi..
16:40:42.158 -> Connecting to WiFi..
16:40:42.669 -> Connecting to WiFi..
16:40:42.669 -> Connected to the WiFi network
16:40:42.669 -> IP Address: 192.168.1.107

Huh that’s funny I had not rolled those back and they worked for me. Anyway glad it is working for you now. Hopefully they will resolve the esp-at library problem…