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
288 stars 108 forks source link

Changing baud rate causes timeout #80

Closed balloob closed 1 year ago

balloob commented 1 year ago

We use esptool-js to power ESP Web Tools. When it starts installing using esploader, it passes an existing port. The port has been opened, used to query improv, and then closed.

ESPLoader will, as part of main_fn(), call await this.change_baud();. This command is causing the connection to timeout and make the connection unusable.

The fix for ESP Web Tools is to apply a patch to the installed node module to comment out the changing of the baud rate. When done, everything works fine.

I've been looking into the code trying to understand what's going on:

Question: would it be possible to skip changing the baud if this.baudrate == this.rom_baudrate ?

igrr commented 1 year ago

Question: would it be possible to skip changing the baud if this.baudrate == this.rom_baudrate ?

Sounds reasonable, I can't think of any downside.

(The whole connection flow could use some clean-up, by the way. It's odd that we have both detect_chip and connect, but we need to call an aptly named main_fn.)

marko-savic commented 1 year ago

Same problem here, and fix by @balloob suggestion.

Jason2866 commented 1 year ago

The change does fix our noticed issue when using current esptool.js With the change it does work well. A new release would be nice.