espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
872 stars 781 forks source link

ESP32-C3 OTA gets stuck due to socket error #684

Open mah-eiSmart opened 1 year ago

mah-eiSmart commented 1 year ago

Hello, I'm using ESP32-C3 mini-1 radio module and test and OTA (over the air update).

Therefore I'm setting up the device as access point and start the web server: _AT+CWMODE=3,1 AT+CWSAP="myssid","",1,0 AT+CIPMUX=1 AT+WEBSERVER=1,80,25

Then I connect to the radio module with a smart phone, open the web page and upload the new bin file, as described in https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32c3/AT_Command_Examples/Web_server_AT_Examples.html#ota-firmware-upgrade-using-a-browser

The radio module returns: _+STA_CONNECTED:"a8:9c:ed:be:76:ca" +DIST_STAIP:"a8:9c:ed:be:76:ca","192.168.4.2" +WEBSERVERRSP:3

What I see is that the OTA does not finish. The message +WEBSERVERRSP:4 does not show up. When I check the debug log, I can see that at a certain time, there is a socket receive error, that is repeated forever.

_... D (57238) httpd_txrx: httpd_req_recv: remaining length = 180576<27>[0m<\r><\n> D (57243) httpd_txrx: httpd_req_recv: remaining length = 179296<27>[0m<\r><\n> D (57247) httpd_txrx: httpd_req_recv: remaining length = 178816<27>[0m<\r><\n> D (57256) httpd_txrx: httpd_req_recv: remaining length = 177536<27>[0m<\r><\n> D (57262) httpd_txrx: httpd_req_recv: remaining length = 176256<27>[0m<\r><\n> D (57264) httpd_txrx: httpd_req_recv: remaining length = 175936<27>[0m<\r><\n>

<27>[0;33mW (62268) httpd_txrx: httpd_sock_err: error in recv : 11<27>[0m<\r><\n> D (62268) httpd_txrx: httpd_recv_with_opt: error in recv_fn<27>[0m<\r><\n> D (62268) httpd_txrx: httpd_req_recv: error in httpd_recv<27>[0m<\r><\n> D (62274) httpd_txrx: httpd_req_recv: remaining length = 175936<27>[0m<\r><\n> <27>[0;33mW (67280) httpd_txrx: httpd_sock_err: error in recv : 11<27>[0m<\r><\n> D (67280) httpd_txrx: httpd_recv_with_opt: error in recv_fn<27>[0m<\r><\n> D (67280) httpd_txrx: httpd_req_recv: error in httpd_recv<27>[0m<\r><\n> D (67286) httpd_txrx: httpd_req_recv: remaining length = 175936<27>[0m<\r><\n> <27>[0;33mW (72292) httpd_txrx: httpd_sock_err: error in recv : 11<27>[0m<\r><\n> D (72292) httpd_txrx: httpd_recv_with_opt: error in recv_fn<27>[0m<\r><\n> D (72292) httpd_txrx: httpd_req_recv: error in httpd_recv<27>[0m<\r><\n> D (72298) httpd_txrx: httpd_req_recv: remaining length = 175936<27>[0m<\r><\n> ..._ [full_log.txt](https://github.com/espressif/esp-at/files/10102959/full_log.txt) How can we overcome this issue? Thx in advance! PS: I recently found out, that when using the ESP32-C3 in station mode and running the OTA over an external access point, the stability is much higher.
ustccw commented 1 year ago

it seems like your wifi tx power is 70, right? what if set AT+RFPOWER=84 and retry again.

mah-eiSmart commented 1 year ago

AT+RFPOWER is 80, which should be the maximum according to documentation. The distance between the smart phone and the chip is about 50cm. I reduced the TX power to check whether there is cross talk, but no effect.

It's definitely a matter of the chip working as access point. In station mode it's much better.