bitdump / BLHeli

BLHeli for brushless ESC firmware
GNU General Public License v3.0
1.94k stars 1.09k forks source link

BLHeli32 - 32708 - CH340 based interfaces fail to write / flash #425

Open airzone-sama opened 4 years ago

airzone-sama commented 4 years ago

Basically the same as issue 422 and 411.

Interfaces using CH340 USB bridge often fail to save configuration, always fail to flash. I've tried a random selection of approx 80 or so atmega328p w/ ch340 boards I have, plus a USB linker based on this chip. For the atmega based boards, I've tried 1-wire and 4-wire interfaces.

Interestingly, Arduino boards with an atmega16u2 USB bridge work fine.

CH340 Drivers tested: 3.4.2014.8 and 3.5.2019.1. I have also used 2 different computers, both Win 10 and both the same result.

Attached log file showing a failed flash.

Log.tlg.txt

4712 commented 4 years ago

@airzone-sama Thanks a lot for your great effort! Very interesting is the fact that reading the echo bytes failed always after 160 bytes. I could not reproduce the failure here with my win 10 system, may be it is related to the main board USB interface. I will try to investigate further and for sure come back with test versions...

4712 commented 4 years ago

@airzone-sama Now I found a machine with win10 where the CH340 Arduino Nano fails to flash,a and shows a similar error! BTW FTDI does not fail... Hopefully I can find a fix soon and come back with a test version. Thanks for your patience!

airzone-sama commented 4 years ago

OK thanks. It's been a hectic few days, so I haven't been able to do further testing.

4712 commented 4 years ago

@airzone-sama Please check out the new released version 32.7.0.9. It should fix the issue. It took some time to get the clue about what happens. It turned out that setting the WriteTotalTimeoutConstant while a current asynchronous write is pending was the problem. Weird, that the issue does not happen with FTDI devices. And for CH340 (and maybe other brand USB/UART chips) it does only seem to happen with specific USB I/O chip sets. Maybe it is also dependent of the OS version and USB driver installed. Now I switched to a fixed write timeout and to waiting for asynchronous write operation to finish before start reading.

Thansk again for your heads up and the testing!