Arduino-Makefile
Arduino-Makefile copied to clipboard
[Cygwin] Arduino port COM3 not found!
I'm working on a project team where members are using Windows, Mac and Linux. People using Mac and Linux are successfully using the Makefile, but people using Windows cannot.
I am able to MONITOR_PORT="/dev/ttyS3" make reset
, (though it required me to upload a program through the arduino IDE before I was able to), but MONITOR_PORT="/dev/ttyS3" make upload
failed.
The full output from running this command can be found here: http://pastebin.com/P0H7jgM7 The gist of it is summarized below:
$ MONITOR_PORT="/dev/ttyS2" make upload
...
- [COMPUTED] DEVICE_PATH = /dev/ttyS2 (from MONITOR_PORT)
...
make do_upload
make[1]: Entering directory '/cygdrive/c/Users/Matt/OneDrive/workspace/RoboBuggy-2015/arduino_src/RadioBuggyMega'
../../../../../../../arduino/hardware/tools/avr/bin/avrdude -V -v -v -p atmega2560 -C ../../../../../../../arduino/hardware/tools/avr/etc/avrdude.conf -c wiring -b 115200 -P com/dev/ttyS2 \
-U flash:w:build-mega2560/RadioBuggyMega.hex:i
avrdude.exe: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "../../../../../../../arduino/hardware/tools/avr/etc/avrdude.conf"
Using Port : com/dev/ttyS2
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude.exe: ser_open(): can't open device "\\.\com/dev/ttyS2": The system cannot find the path specified.
When I try to 'MONITOR_PORT="COM3" make reset', I get the following error. ```
Resetting Arduino...
../Arduino.mk:1300: *** Arduino port COM3 not found!. Stop.
Repro _Installation_
- Install cygwin with make and python installed from cygwin repos.
- Install pip per instructions on pip website.
wget https://bootstrap.pypa.io/get-pip.py /user/bin/env python get-pip.py 3. Install pyserial pip install pyserial 4. make reset/make upload Also of note:
Matt@icarus /cygdrive/c/Users/Matt/OneDrive/workspace/RoboBuggy-2015/arduino_src/RadioBuggyMega $ python Python 2.7.8 (default, Jul 28 2014, 01:34:03) [GCC 4.8.3] on cygwin Type "help", "copyright", "credits" or "license" for more information. >> import serial >> s = serial.Serial("COM3") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/serial/serialutil.py", line 282, in __init__ self.open() File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 289, in open self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK) OSError: [Errno 2] No such file or directory: 'COM3' >> s = serial.Serial("/dev/ttyS2") (successful)
Any thoughts/reports on how to make uploading on windows work? If you need any more information, I can provide it. Thanks!
Windows support is little tricky and myself and most of the core contributors don't have windows machines to try it out.
When you are using the Arduino IDE from windows what is the serial port you are using? Also checkout the comments in #94
you just need the correct port that your arduino is connected to, it certainly won't be anything like /dev/ttyS2 and its not COM3
Check out #155 - IIRC in Windows you either use just the com port number "3" or try lowercase com3.
Simon, the /dev/ttyS2 is legit, Cygwin adds these shortcuts.
Simon, the /dev/ttyS2 is legit, Cygwin adds these shortcuts.
seriously, it creates an rs232 device?
i actually think you'd be better off running linux in a vm than using cygwin.
Another idea would be to swap Cygwin for MSYS(2). I use MSYS2 as 'subsystem' (shell) on Windows, make upload
works, and even make monitor
with PuTTY and a tiny patch.
Side note: Please let me know if you're interested in the patch for using PuTTY with make monitor
Please let me know if you're interested in the patch for using PuTTY with make monitor
If it makes life easier for people using Windows and doesn't affect existing Linux/mac users then I am definitely interested :)
My pleasure :)
Please see https://github.com/sudar/Arduino-Makefile/pull/295 Note: Only tested on Windows with MSYS2, NOT on Cygwin nor *nix
Re: @sej7278 @sudar Per the Windows Device manager and the Arduino IDE, the correct com port is selected. On windows, capitalization generally doesn't matter, though I'm not positive about serial ports. Either way, though, COM is capitalized when used by windows.
The following command works:
$ MONITOR_PORT=/dev/ttyS2 make reset
And when I modify Arduino.mk as follows
1273: # Use submake so we can guarantee the reset happens
1274: # before the upload, even with make -j
1275: upload: $(TARGET_HEX) verify_size
1276: #$(MAKE) reset
1277: $(MAKE) do_upload
The following command works:
MONITOR_PORT=com3 make upload
I feel like 'make reset' working via /dev/ttyS2 is very telling; it looks like cygwin python (which is used for make reset?) and the avr upload binary are expecting cygwin and windows ports respectively, thus a cascaded 'make reset' and 'make upload' does not work.
Just to confirm, I should be using Cygwin, python for cygwin, and pyserial for cygwin through pypi? I might try native python and native pyserial, and see what happens.
EDIT: it looks like when com is capitalized under win32 python, then the following happens:
../../../../../../../arduino/hardware/tools/avr/bin/avrdude -q -V -D -p atmega2560 -C ../../../../../../../arduino/hardware/tools/avr/etc/avrdude.conf -c wiring -b 115200 -P comCOM6
-U flash:w:build-mega2560/RadioBuggyMega.hex:i
avrdude.exe: ser_open(): can't open device ".\comCOM6": The system cannot find the file specified.
I now see why you wanted me to lower-case COM :P. As mentioned above, this turned out not to be the show-stopper.
EDIT2: I installed win32 python and pyserial, and with the makefile modified as above, I can MONITOR_PORT=com3 make upload
successfully, but I get the following output when I run MONITOR_PORT=com3 make reset
:
Resetting Arduino...
../Arduino.mk:1300: *** Arduino port com6 not found!. Stop.
Hi @msebek,
Could you try applying patch https://github.com/sudar/Arduino-Makefile/pull/295 ? This changes the behaviour on Windows for the get_monitor_port function and probably fixes this issue. Hope this helps...
I'm a little confused by this - you said you ran MONITOR_PORT=com3 make reset
and the output was:
Resetting Arduino...
../Arduino.mk:1300: *** Arduino port com6 not found!. Stop.
Are you positive you ran it with com3
and not com6
?
I think the current makefile should work if you run every command with com3
as the monitor port, don't use the /dev/ttyS3
naming for any commands.
Hi @msebek , @peplin Please test https://github.com/sudar/Arduino-Makefile/pull/297 where I modified support for Cygwin as well as MSYS. Cygwin style devices are used for the reset command, and for the rest normal Windows port names are used.
Please note that you should use lowercase portnames, eg. MONITOR_PORT = com3
Hope this helps...
Hi,
I ran into this problem as well. I'm running Windows 10 with Cygwin. The versions reported by Arduino.mk are: ARDMK_VERSION = 1.6, CC_VERSION = 7.3.0 (avr-gcc), ARDUINO_VERSION = 1813
I discovered a workaround: launch the Arduino IDE, open the Serial Monitor (Ctrl-Shift-M), then close the monitor (but leave the sketch open - this is important!), then run make upload
, and everything works as expected. Perhaps looking at the Arduino IDE source code to see how it initializes the port may give some clues to modifying ard-reset-arduino.
There is still one minor problem, though. There is a known issue with Cygwin make, in that the -C option to change directories can take several seconds to complete. Normally this is not an issue (other than being annoying), but in this case it causes a significant delay between the ard-reset-arduino command and the avrdude command. Because of the delay, the Arduino completes its reset and is completely up and running before avrdude is invoked. Is the reset command even necessary? My understanding of the ISP process is that the first thing the programmer does is reset the microcontroller anyway.