esp-at icon indicating copy to clipboard operation
esp-at copied to clipboard

AT firmware 2.4.0 on ESP32-C3 - Frequent WiFi disconnections

Open jaygitdev opened this issue 2 years ago • 2 comments

I am using an ESP32-C3 DevkitM-1 with AT FW version 2.4.0 and I'm having frequent dropped connections when transferring data. Below are the AT Commands I'm sending:

AT+CWMODE=2      // STA Mode
AT+CWSAP="esp32test","Aaaaa11111",5,3   // login, pw, channel 5, 3 max connections
AT+CIPMUX=1  //
AT+CIPSERVER=1,443,"SSL"  // SSL connection on socket 443

I'll then connect to the webserver, login to 192.168.4.1 in my browser and, it will confirm a connection is made.

I'll then send it:

AT+CIPSEND=0,321 // Send 321 chars

I'll receive a ">" and then send it:

HTTP/1.1 200 OK
Content-Type: text/html
Connection: close

<!DOCTYPE HTML>
<form method="post" enctype="multipart/form-data">
 <div>
   <label for="file">Choose file to upload</label>
   <input type="file" id="file" name="file" multiple>
 </div>
 <div>
   <button>Submit</button>
 </div>
</form>
</html>


This effectively will send it a navigation box and an upload button for me to stream data from a phone (or other device) to the ESP32 for display over the UART.

I sent it a 10 MB file and it loses connection while sending the file and essentially stops transferring data (though it will occasionally pick back up again and then stop again). I've tried it with multiple baud rates (921600, 115200, 57600) and the issue still persists. I've tried it in mode 1 and 3 as well with no luck. I've used the same AT commands on the ESP32-S2 Saola-1 and the issue does not seem to be present. This seems to point to an issue with either the hardware or the firmware.

I've tried this on multiple units, even ordered a new batch to try it on a different batch and the issue is reproducible. With future support going from the S2 to the C3, this is very concerning as the latest firmware seems to be unable to keep a stable connection.

Any suggestions/insight would be greatly appreciated!

jaygitdev avatar Jun 01 '22 15:06 jaygitdev

@jaygitdev could you please enable debug log and ssl logs to see what happened.

  • ./build.py menuconfig -> Compent config -> Log output -> Default log verbosity -> Verbose
  • ./build.py menuconfig -> Compent config -> mbedTLS -> Enable mbedTLS debugging -> Set mbedTLS debugging level -> Verbose

ustccw avatar Jul 04 '22 03:07 ustccw

I apologize for the late response, I didn't see this come in.

In the past, I have just used the binaries so my system wasn't previously setup for this. I was setting up my system and ran into some issues and I'm not sure how to resolve them prior to testing the suggestions you provided.

I went to [https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32c3/Compile_and_Develop/How_to_clone_project_and_compile_it.html# ] to follow the steps there. I started by installing esp-idf and successfully ran the hello_world example as suggested.

I then tried to install the dependencies for esp-at while using build.py and got the following:

Ready to install ESP-IDF prerequisites..
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ccache is already the newest version (3.7.7-1).
libffi-dev is already the newest version (3.3-4).
libffi-dev set to manually installed.
libusb-1.0-0 is already the newest version (2:1.0.23-2build1).
libusb-1.0-0 set to manually installed.
python3 is already the newest version (3.8.2-0ubuntu2).
python3 set to manually installed.
python3-setuptools is already the newest version (45.2.0-1).
dfu-util is already the newest version (0.9-1).
gperf is already the newest version (3.1-1build1).
ninja-build is already the newest version (1.10.0-1build1).
git is already the newest version (1:2.25.1-1ubuntu3.4).
wget is already the newest version (1.20.3-1ubuntu2).
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
cmake is already the newest version (3.22.1-0kitware1ubuntu20.04.1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2.16) but 1.1.1f-1ubuntu2.12 is to be installed
 linux-modules-5.13.0-48-generic : Depends: linux-image-5.13.0-48-generic but it is not going to be installed or
                                            linux-image-unsigned-5.13.0-48-generic but it is not going to be installed
 linux-modules-extra-5.13.0-48-generic : Depends: linux-image-5.13.0-48-generic but it is not going to be installed or
                                                  linux-image-unsigned-5.13.0-48-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
A fatal error occurred: install prerequisites failed! Please manually run:
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0

I then tried to follow the suggestions and ran the link suggested:

:~/esp/esp-at$ sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ccache is already the newest version (3.7.7-1).
libffi-dev is already the newest version (3.3-4).
libffi-dev set to manually installed.
libusb-1.0-0 is already the newest version (2:1.0.23-2build1).
libusb-1.0-0 set to manually installed.
python3 is already the newest version (3.8.2-0ubuntu2).
python3 set to manually installed.
python3-setuptools is already the newest version (45.2.0-1).
dfu-util is already the newest version (0.9-1).
gperf is already the newest version (3.1-1build1).
ninja-build is already the newest version (1.10.0-1build1).
git is already the newest version (1:2.25.1-1ubuntu3.4).
wget is already the newest version (1.20.3-1ubuntu2).
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
cmake is already the newest version (3.22.1-0kitware1ubuntu20.04.1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2.16) but 1.1.1f-1ubuntu2.12 is to be installed
 linux-modules-5.13.0-48-generic : Depends: linux-image-5.13.0-48-generic but it is not going to be installed or
                                            linux-image-unsigned-5.13.0-48-generic but it is not going to be installed
 linux-modules-extra-5.13.0-48-generic : Depends: linux-image-5.13.0-48-generic but it is not going to be installed or
                                                  linux-image-unsigned-5.13.0-48-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I then tried that suggestion:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.13.0-48-generic linux-hwe-5.13-headers-5.13.0-48
  linux-image-5.13.0-48-generic linux-modules-5.13.0-48-generic
  linux-modules-extra-5.13.0-48-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-5.13.0-48-generic
Suggested packages:
  fdutils linux-doc | linux-hwe-5.13-source-5.13.0 linux-hwe-5.13-tools
The following NEW packages will be installed:
  linux-image-5.13.0-48-generic
0 upgraded, 1 newly installed, 0 to remove and 184 not upgraded.
12 not fully installed or removed.
Need to get 0 B/10.0 MB of archives.
After this operation, 10.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 304722 files and directories currently installed.)
Preparing to unpack .../linux-image-5.13.0-48-generic_5.13.0-48.54~20.04.1_amd64
.deb ...
Unpacking linux-image-5.13.0-48-generic (5.13.0-48.54~20.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-5.13.0-48-gen
eric_5.13.0-48.54~20.04.1_amd64.deb (--unpack):
 unable to open '/boot/vmlinuz-5.13.0-48-generic.dpkg-new': Operation not permit
ted
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-5.13.0-48-generic_5.13.0-48.54~20.04.1_amd6
4.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

At this point, I'm not really sure what to do or how to install esp-at to be able to setup the build command as you suggested.

I realize this is a different problem than the original problem, but I'll need to resolve this issue before I can setup the project as you suggested (unless you're able to either provide binaries for me to test or run the initial described problem with the 2.4.0 binaries from the ESP32-AT page). Ideally, I'd like to get this working so I can test this moving forward.

Any help you can give me would be appreciated. Thanks!

jaygitdev avatar Jul 12 '22 21:07 jaygitdev