-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recover from serial errors when flashing (ESPTOOL-123) #182
Comments
I am also having this issue very frequently. Baud rate doesn't seem to affect it. I've tried many common baud rates in the range of 9600 - 115200 and it happens on all of them. Sometimes I have to reflash like 10 times before it's finally successful. I've checked all the voltages as well and they are all what they should be. Although I don't think this is the problem, I should also mention that I'm flashing it through a teensy 3.2 using the following code.
|
I am in a situation similar to @rspenc29. I need to be able flash ESP-WROOM-02 via another device. But sometimes a single byte gets lost (every ~10kB or even less often) and it stops the flashing operation. I tried to slightly modify the application to retry if a command failed but it's not as easy as I hoped. During stub uploading (cmd= |
I modified the "bridge device" to interpret the bootloader packets as they go from the PC to the ESP module and drop those that are too short. And I made my fork of esptool.py retry the commands if they failed. It is a temporary solution for me and I hope that soon we can have esptool.py recover from errors autonomously. The modification of esptool.py is available here: adamglowacki/esptool@440828a |
@adamglowacki do you have the arduino code to drop the short packets? im using a teensy and get an upload failure at some point after a successful startup (chip id is good, stub upload is good), and I cannot complete an entire write of the flash ram. |
I don't have the Arduino code - the device I mentioned is based on a custom board with a microcontroller, software is written in plain C. But the algorithm itself is quite simple. I parse all the incoming packets and forward them to the ESP module only if their real length is the same as the one declared inside the packet. I process every incoming byte one by one - detect the packet boundaries (See SLIP on Wikipedia) and at the same time unescape all the bytes inside the packet. When finally I get the unescaped packet, I compare the length field with the length of what I have just unescaped. I don't bother with computing the checksum or interpreting the command codes. The length-check is enough for me. I limited the size of the unescaped packets to 1024B. |
I have a question. I created retransmission packets in esptool. Program(esptool) respond correct frame, but the problem is that md5 isn't correct . Example: after programming md5 does not match: / md5 |
@dominikzaq I didn't see this post until just now. Continuing this discussion on the other issue you opened, #428. |
=)) If you are using a DIY board, this problem is due to the lack of a capacitor near the 3.3V of the module ( 10uf + 0.1uF ) , the reason being the flash chip when erase a page will cause a spike of voltage drop because the cap inside the module didn't handle it very well. |
@curlyz In our custom PCB there are parallel capacitors 10uF+100nF on 3.3V, nonetheless there are problems with communication. At least some of them (or all, I don't know) happen between the PC and the "bridge" device. Therefore correct handling of errors due to unreliable connections by esptool.py would be great for me. |
I had the same issue. I flashed esp from VirtualBox (Debian on Windows). I tried to use different esp or restart the VirtualBox and finally helped to restart Windows. |
It would be highly desired to have an automatic retry of the failed block. Simply reducing the BAUD rate is not a solution since the operation time at lower baud rate is very high. |
At high baud rates or in noisy environments, data is sometimes corrupted over the serial link when flashing. At the moment, this leads to fatal errors like the following:
(0xC1 is
ESP_BAD_DATA_CHECKSUM
)Reflashing usually succeeds, but esptool needs to be run again.
Ideally, esptool.py will be able to recover from this error automatically by re-sending the bad data block.
The text was updated successfully, but these errors were encountered: