Avrdude: ser_open(): can't open device "\\.\COM36": The system cannot find the file specified

When flashing the Model01, I get the folowing error in Windows 7:

avrdude: ser_open(): can't open device "\\.\COM36": The system cannot find the file specified.

I had this problem initially when I got the Model 01, but then somehow got it working, but I don’t remember how. I have been happlily flashing the device every now and then to modifiy my layout without issues. Yesterday I refreshed everything from github. After flashing it with the default setup, the keyboard was detected as a new device and got a new COM port. After this I got the above problem again.

The device is on COM36, the Prog button turns red as it should when flashing starts, but then it fails with the above error. Tools -> Get Board Info in the Arduino app properly returns info.

I noticed that the Model 01 Bootloader is on COM15, and it switches to that during flashing. This can be seen in the Windows Device Manager. Should the port number stay the same, or should flashing work even if the “normal” COM port and the Bootoader are on different COM ports?

2018-02-11%2011_05_09-Device%20Manager

The bootloader is apparenlty supposed to be on a different port. Here’s the verbose output when trying to flash:

Arduino: 1.8.5 (Windows 7), Board: "Keyboardio Model 01"

Sketch uses 15828 bytes (55%) of program storage space. Maximum is 28672 bytes.
Global variables use 1470 bytes (57%) of dynamic memory, leaving 1090 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM36
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
PORTS {COM1, COM36, } / {COM1, COM36, } => {}
Uploading using selected port: COM36
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM36 -b57600 -D -Uflash:w:C:\Users\Bjorn\AppData\Local\Temp\arduino_build_897959/Model01-Firmware3.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM36
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "\\.\COM36": The system cannot find the file specified.



avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I was able to flash the keyboard manually running avrdude and using the bootloader port COM15.

How is it supposed to work when using the IDE? In the IDE only the keyboard port COM36 is shown, and that’s what I have selected. The bootloader port only gets activated when flashing is enabled. How does the IDE find the bootloader port?

Maybe I had edited som file and hardcoded the bootloader port when I got it working earlier. Now I lost that change when I did a clean checkout from github.

It works using the IDE if I keep the Prog button down and plug in USB cable when the IDE is searching for the bootloader port:

Archiving built core (caching) in: C:\Users\Bjorn\AppData\Local\Temp\arduino_cache_301402\core\core_keyboardio_avr_model01_0c812875ac70eb4a9b385d8fb077f54c.a
Sketch uses 15828 bytes (55%) of program storage space. Maximum is 28672 bytes.
Global variables use 1470 bytes (57%) of dynamic memory, leaving 1090 bytes for local variables. Maximum is 2560 bytes.
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM15, } => {COM15, }
Found upload port: COM15
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM15 -b57600 -D -Uflash:w:C:\Users\Bjorn\AppData\Local\Temp\arduino_build_920471/Model01-Firmware3.ino.hex:i 

So the problem is apparently that the IDE can’t find the bootloader port when the keyboard is plugged in and I press the Prog button. It does light up red as it should, and I can see in Windows Device Manager that COM15 gets enabled during the process, but it does not work.

Any ideas what is causing this? A timing issue? It did not work when I hardcoded COM15 into the avrdude command line by editing hardware/keyboardio/avr/platform.txt

1 Like

I don’t know what causes it, but once you flash it successfully using avrdude, it keeps working in Arduino until it does not.

It’s worth checking out the wiki.

Installing USB Driver on Windows:

Command Line Upload Instructions for Windows:

1 Like

Sorry, I don’t really get what you are saying.

I have the USB driver succesfully installed, and I have succesfully used the IDE for months. Flashing from the IDE stopped working after I did a clean pull from github and updated the firmware in the keyboard. So I’d assume my Windows environment is fine. My only issue right now is that the only way I can flash the keyboard is by plugging in the USB cable while pressing Prog. This is fine, but not as convenient as before when I didn’t have unplug-plug the USB cable every time I wanted to modify my layout (which I do pretty much now that I’m experimenting to find the ultimate layout).

I haven’t read the command line guide yet (but I also did flash it succesfully using the command line as I wrote above). I’ll have a look at that it if gives any hint to my issues. Thanks for the link!

That has been my experience, as well. Updating Kaleioscpoe from GitHub causes me problems. Flashing via avrdude works. As mentioned on another thread, before and after flashing using avrdude, Model01 is assigned different COM ports.

Using the new COM port, I’m able to flash normally from the IDE. I’ll have to pay attention and see if it magically swaps ports again at some point. Note that I’m consistently using the same physical USB port.