Chat freely about anything...

User avatar
By esp8266_abc
#89183 Hi Buddies,

Has anyone paied attention to the time consumed during an OTA to the ESP8266 module?

I checked to find that, it takes at least around 10 seconds for an around 500KBytes of Image even in an LAN ! Around 5 seconds is taken up for flash erase and burn sector by sector, and more than 5 seconds for bin image portion piece fetching from the server -- Why could not speed up the network speed? since there is limited buffer inside ESP8266 so we have to let the network transmission to halt for some time before the previous pieces of bin image has been processed to release the buffer!

If OTA via the Internet, the network speed might be longer and the OTA time would last more than 10s.

Any suggestion or hints to Shorten my OTA period?

User avatar
By eriksl
#89188 I don't think you can get it much faster than that. The issue is the writing of the flash, that's a slow procedure. Also flashing a sector is done with interrupts switched off, so any traffic from the access point to the ESP is dropped. The access point and/or the server draw the conclusion the ESP can't keep up and lower the throughput.

Besides that, wireless speed is never comparable to wired speed. Count on half the speed, at most. Also although the CPU of the 8266 isn't really slow, the WLAN hardware is very simple, so much of the handling must be done by the CPU itself.

When I do a benchmark, without any flashing, and using highly optimised code, I can achieve 320 kbps at TCP and 450 kbps and UDP. That's the fastest you'll get, really. With flashing and erasing included, it will drop to about 65 kbps. Although it may get a lot quicker if only a few sectors are to be rewritten (my OTA code does a compare before erase/write).

I also compared procedures with flashing all sectors in one go and then writing all of them, as opposed to do it interleaved. It appears erasing all sectors in go does NOT give a speed advantage. Also if not handled properly, it may easily trigger the watchdog resets. So I keep doing it interleaved.
User avatar
By esp8266_abc
davydnorris wrote:Is there any reason you want to speed it up? Is it just a worry about power consumption?

Also @eriksl - would love to see more on your benchmarks - very interested to know more on top sustained transfer speeds and how they can be achieved

Thanks for the replies!

Sure we are considering about the TIME, other than POWER. Why did you ask about power, buddy? :)

In fact wee are just considering about how to speed up the image flashing for mass production. The traditional flash-burning via UART is too time-consuming, so we are trying to burn flash via an OTA. It saves time obviously, but is still time-consuming, and we are trying to save more. This is the first, as well as the primary reason, why we are considering about the OTA time consumption.

Meanwhile, as a PRODUCT feature, shorter period of OTA procedure also indicates less risk of unexpected fault possibility due to the network exceptions, and less snifferring risk via the Internet.

Actually we also did such a test to comment out the operations of burnning flash during an OTA so as just to test the network speed to a http server during an OTA, and we achieved a speed of 5- seconds to download an BIN file of nearly 600KBytes. That is, we have a benchmark speed of 100+KBytes/s or around 1MBPS without flashing, much faster than what @eriksl provided above. Even if we perform a complete OTA successfully with flahsing(the operations of flash erase and burn), via a LAN(sure, a wireless LAN since 8266 is a wireless device), the speed is something around 9-10 seconds to compelete the OTA of an image of nearly 600KBytes. That is, the speed is upto 60KBytes/s or around 500Kbps with flashing( operations of flash erase and burning).

But compared with the 8266 RF WIFI Speed itself up to 20Mbps, the speeds are still tooooooooooooo slow, even though there is an obvious bottleneck of flash operation. --- The speed of a UART-8266 WIFI module is slow but just because the UART is slow. However the RF wifi is not slow and an OTA does not need the UART and IS NOT bottlenecked by the UART port.