platformio / platform-atmelmegaavr

Atmel megaAVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelmegaavr
Apache License 2.0
29 stars 22 forks source link

Unable to upload to Nano_Every #6

Closed chrisinabox closed 4 years ago

chrisinabox commented 4 years ago

I have been having persistent issues uploading to the Nano_Every from PIO with the atmelmegaavr platform (sample verbose at bottom).

It seems to be that the upload hangs as it forces a board reset and then waits for the upload port which I don't think is needed (I am no expert here). I have not had these issues with the Arduino IDE which is using the same version of avrdude (at this moment in time on my machine) so am fairly certain it's due to how PIO is handling uploads to this board.

I have managed to successfully program the board by modifying the nano_every.json so these two lines are false: "require_upload_port": false, "wait_for_upload_port": false

Verbose output for non modified json is consistently as follows:

<lambda>(["upload"], [".pio\build\nano_every\firmware.hex"])
AVAILABLE: jtag2updi
CURRENT: upload_protocol = jtag2updi
BeforeUpload(["upload"], [".pio\build\nano_every\firmware.hex"])
Auto-detected: COM23
Forcing reset using 1200bps open/close on port COM23
Waiting for the new upload port...
avrdude -v -p atmega4809 -C C:\Users\nocma4\.platformio\packages\tool-avrdude-megaavr\avrdude.conf -c jtag2updi -D -V -b 115200 -e -P "COM23" -U flash:w:.pio\build\nano_every\firmware.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\nocma4\.platformio\packages\tool-avrdude-megaavr\avrdude.conf"

         Using Port                    : COM23
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "\\.\COM23": Access is denied.

avrdude done.  Thank you.

*** [upload] Error 1
chrisinabox commented 4 years ago

My mistake - only "wait_for_upload_port": false. The other line causes it to fail for somewhat obvious reasons.