Closed mcuee closed 1 year ago
The following is a different issue but with the same symptom. It is not using CH340 but the original ATmega16U2 USB to Serial FW. https://forum.arduino.cc/t/ser_open-can-t-set-com-state-for-com4-changes-uno-not-detected-solved/659323/8
I found a solution for using the latest version 3.8 driver (CH341SER 3.8 version). I need to click the check box in the advanced settings --> Enabling the Serial Port Enumerator (SerEnum)
. There are no checkboxes for the version 3.5 driver.
Before enabling the option and after enabling the option. I have no idea why WCH does not make this option default.
PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1215v1 -C .\avrdude_pr1215v1.conf -p m328pb -c arduino -P COM4
avrdude_pr1215v1 error: cannot set com-state for \\.\COM4
avrdude_pr1215v1 error: unable to open programmer arduino on port COM4
avrdude_pr1215v1 done. Thank you.
PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1215v1 -C .\avrdude_pr1215v1.conf -p m328pb -c arduino -P COM4
avrdude_pr1215v1: AVR device initialized and ready to accept instructions
avrdude_pr1215v1: device signature = 0x1e9516 (probably m328pb)
avrdude_pr1215v1 done. Thank you.
Somehow this is dependent on the PC. I do not need to enable serenum to get the thing working on my other laptop running Windows 10.
C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c urclock -P COM4 -p m328p -xshowall
avrdude: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00 application 0 store 0 meta 0 boot 512 o4.4 --s-h-r-- vector 0 (RESET) ATmega328P
I have to use older version of the driver to work reliably in the end. The new version just does not work properly.
In case someone else are having the same issue, what driver version are you using (that works), and where did you download it from?
Since I was not able to find a way to source an older version of the driver directly from the WCH website, I am recommending sourcing it from a SparkFun tutorial since I consider SparkFun to be a trustworthy source. The instructions are here:
https://forum.arduino.cc/t/arduino-nano-upload-error/1146296/14
Yes, SparkFun version (WCH driver version 3.4) works fine.
I will carry out a bit more tests to see which version does not work and which versions work. I believe all the older versions (3.7 and earlier) work fine except latest version 3.8 but I need to double check.
Version 3.8 does not work reliably (my test shows problem only in Windows 11 but not Windows 10). https://wch-ic.com/downloads/CH341SER_ZIP.html https://wch-ic.com/downloads/CH341SER_EXE.html
The scope of application | version | upload time | size -- | -- | -- | -- CH340G,CH340T,CH340C,CH340E,CH340B,CH341A,CH341T,CH341B,CH341C,CH341U | 3.8 | 2023-03-16 | 642KBAnother reliable place to download is from Microsoft. They have version 3.8.2023.2 (problem version), version 3.5.2019.1 and version 3.4.2014.08 (both are working). There is no driver installer included but you can use Windows Device Manager to install the driver. https://www.catalog.update.microsoft.com/Search.aspx?q=CH340 wch340_v34.zip wch340_v35.zip wch340_v38.zip
Interestingly I do not seem to have issues using serialupdi with latest driver.
I think this is not an avrdude issue but an WCH CH340 driver issue.
Still it is good to put some info here so that people can reference to it, since there are quite some similar issues posted online.
I was playing with CH341A yesterday and install the latest CH341SER driver for CH340/CH341. Then I was encountering the above issue. Reverting to an old version sorted out the issue for me -- I am using version 3.5 (3.5.2019.1) and it is working fine.
Problematic driver version: http://www.wch-ic.com/downloads/CH341SER_EXE.html (version 3.8, uploaded on 2023-03-16, size 642KB)
Working driver version:
If you can not find the older driver version, here is one link for version 3.5. https://github.com/wemos/ch340_driver
Good and bad run log for reference: