espressif / esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
https://espressif.github.io/esptool-js/
Apache License 2.0
251 stars 101 forks source link

Configurable chip erase timeout #111

Closed breiler closed 7 months ago

breiler commented 9 months ago

I have a device where the flash erase takes around 12 seconds and will intermittently fail when the timeout is reached.

A simple fix would be to increase the default 12 second timeout, but I decided to make it configurable instead making it possible to override it.

I know that the ESPLoader.CHIP_ERASE_TIMEOUT can be overrided by accessing it directly. But considering its naming pattern with upper case I assume that it should be considered a constant.

balloob commented 8 months ago

How does esptool.py define this value? It seems weird that we would expect users to come up with a value. Should we define a default per chip?

breiler commented 8 months ago

I have boards with the same specs but from different vendors, and they behave differently...

To have the user not needing to care about this would be great, but I think that it will be hard to find one optimal setting for each chip?

Looks like esptool has one default setting with the option to override it: https://github.com/search?q=repo%3Aespressif%2Fesptool%20chip_erase_timeout&type=code

balloob commented 8 months ago

Ha, their timeout is 120s!

Since the goal of esptool.js is to stay in sync with the Python version, I suggest we adopt that timeout instead.

breiler commented 8 months ago

Lol, I lazily read 12:ish something and thought that it was 12 seconds... 🤦🏻‍♂️ Well that will be enough to fix our use case.

I can close this PR if you don't see the value of adding the option to override the timeout as well (like they have in esptool.py).