Closed kaofishy closed 2 years ago
@kaofishy Thanks for reporting. The Arduino 2.0-rc7 works well on a Mac computer, and I think the Mac recognize USB much faster than other systems. I'll setup a Windows computer later to test.
@kaofishy The bug can be reproduced on a Win10 desktop computer with Arduino 2.0-rc7, I'll try to make the upload code try for multiple times.
@kaofishy Please replace the platform.txt and vnproch55x.exe. And then see if it works.
On my computer the upload starts about 300ms after the execution vnproch55x.exe.
@DeqingSun I think you accidentally attached the macOS binary instead of the Linux and Windows ones.
@DeqingSun FYI I compiled it from source from your repo and it does work on my Linux machine now :+1:
@kaofishy You are right I attached the Mac version. Try this one. vnproch55x.exe.zip
@DeqingSun Just tested it on Windows, it's working consistently now. FYI I can confirm that on my machine it takes about 0.5s (~four retries) to connect to the bootloader. Thanks for looking into this so promptly.
On the 2.0 IDE I can't find an option for uploading with CDC, only via serial (and the serial port doesn't show). Works fine on the old IDE. But after I uploaded through the old IDE with CDC the serial port shows up with the 2.0 IDE and I can upload through there.
Strange, and I think it's probably the new IDE being wonky, but I thought I'd mention it in case someone else runs into the same problem.
Thanks for the library!
@domdfcoding I'm not sure if you mean you can not see the "USB" upload option. I've tested 2.0.1 on Mac and 2.0.0 IDE on Win10 without CH552 plugged. And they can start the uploading process.
The upload process is not done with the CDC but with the bootloader code. If you have CDC, the upload process can send signal to CH552 and let it jump into bootloader (no longer CDC), or you can enter the bootloader manually by holding a button and plug in the board. Either way the uploading program will communicate with the bootloader, not the CDC interface.
When using the latest Arduino 2.0 release candidate, upload on a CH552 already programmed with a CDC enabled sketch fails with the following error:
I was able to replicate this on both Linux and Windows with multiple boards. Manually triggering the USB bootloader and then upload works however.
This issue does not happen on Arduino 1.8.
I suspect there's a timing issue where there's not enough time to enumerate the device between the 1200bps trigger and the programming step, since the whole upload process feels much faster on 2.0 compared to 1.8.