esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
457 stars 111 forks source link

Esp8266 baud rate ignored with Flasher::connect #472

Closed loucass003 closed 5 months ago

loucass003 commented 10 months ago

I am trying to flash an esp8266 board with a speed of 921600

but the flasher baud is ignored in the connect function

// Now that we have established a connection and detected the chip and flash
        // size, we can set the baud rate of the connection to the configured value.
        if let Some(baud) = speed {
            match flasher.chip {
                Chip::Esp8266 => (), // Not available
                _ => {
                    if baud > 115_200 {
                        warn!("Setting baud rate higher than 115,200 can cause issues");
                        flasher.change_baud(baud)?;
                    }
                }
            }
        }

this does not seem right as I am in fact able to call the function after using connect and the flashing does complete without issue.

    let mut flasher = Flasher::connect(interface, info.clone(), Some(921600), true).expect("unable to connect");
    flasher.change_baud(921600).unwrap();

is there a particular reason on why the esp8266 is ignored and not simply prompting the warning like the others?

jessebraham commented 10 months ago

I don't know that there's any specific reason for this. Seems to have been this way since 2020 when it was added.

Looking at esptool it doesn't look like they support setting the baud rate for the ESP8266 either, unless I've missed something. It's been so long since I've used that chip I frankly don't remember much about it, sorry.

loucass003 commented 10 months ago

from esptool code https://github.com/espressif/esptool/blob/master/esptool/loader.py#L1084-L1085 could it be that the STUB loader allows for the baud rate to be changed ?

Edit:

it looks like there is not even a check at all https://github.com/espressif/esptool/blob/master/esptool/loader.py#L313 as you can set the baudrate directly from the aguments

loucass003 commented 10 months ago

Ok so after investigating a bit more on this, it looks like you can set the baudrate higher than 115200 after loading the stub.

So initially you shoud:

jessebraham commented 5 months ago

We've decided to drop support for the ESP8266 (see #576), so closing this issue.