• So I hooked up two USB-TTL converters and had a look at the traffic going to and from the ESP8266 and I have a few findings.

    1. The network_js.c implementation limits the number of bytes sent on each AT command to ESP to 536 bytes, even though the AT command can take up to 2048 bytes of data for each command. This is probably for a good reason, since that code can be used for other transports then the ESP, but maybe it could be possible to tweak it if you know what transport that will be used.

    2. The "ESP8266WiFi_0v25" module uses the AT+CIPSEND command for sending, which is a synchronous version that means that Espruino will say "I want to send X bytes", ESP: "OK", Espruino: "here's the data", ESP "Got that, and now I have sent it". Then the Espruino can send the next chunk of data. There's another command called AT+CIPSENDBUF that can be used to add data to the ESP:s send buffer, so that more data can be pushed in without waiting for all data to be sent. It's more complex to use since it requires you to make sure the buffer has space etc.

    Just tweaking the chunksize so that 2048 bytes of data in sent in each AT+CIPSEND increases throughput to ~12kB/s, but in order to go above that I guess the logic needs to be rewritten to use AT+CIPSENDBUF instead so that the wifi connection have data to send at all times. I'll see if I have the possibility to make a working implementation of this.


Avatar for erikboto @erikboto started