Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Bug report] Cannot upload firmware to Arduino Leonardo. Port enumerated too quickly #691
Operating system: Windows 7 64 bit
PlatformIO Version (
Description of problem
Cannot upload software to Arduino Leonardo. Instead of waiting for new port, avrdude is called with old port parameter.
Steps to Reproduce
In device manager i see that COM7 disappears and for moment COM9 appears. SW should be uploaded to COM9.
I fixed it by modifying platformio\builder\tools\pioupload.py , function WaitForNewSerialPort. I added 1 second delay at beginning of this function, so there's time for port to enumerate, but I'm almost sure that this is not correct solution (i mean, it works, but it's just quickfix).
def WaitForNewSerialPort(env, before): print "Waiting for the new upload port..." prev_port = env.subst("$UPLOAD_PORT") new_port = None elapsed = 0 sleep(1) while elapsed < 5 and new_port is None: now = get_serialports() for p in now: if p not in before: new_port = p['port'] break before = now sleep(0.25) elapsed += 0.25 if not new_port: for p in now: if prev_port == p['port']: new_port = p['port'] break if not new_port: env.Exit("Error: Couldn't find a board on the selected port. " "Check that you have the correct port selected. " "If it is correct, try pressing the board's reset " "button after initiating the upload.") return new_port
I did it.
are executed directly one after other (maybe 50-100ms delay)
Please re-test the latest http://docs.platformio.org/en/latest/installation.html#development-version
added a commit
Jun 13, 2016
added a commit
Jun 14, 2016
avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
avrdude: ser_open(): can't set com-state for "\.\COM9"
avrdude done. Thank you.
Code is not uploaded on arduino uno board. Help me