Of course, this a very hacky solution hard linking all the directory and file paths. I m sure more knowledgeable folks can do it right with relative paths or using environment variables.
I hope this helps… either now or someone who has the same issue in future…
Configuring upload protocol...
AVAILABLE: atmelice_isp
CURRENT: upload_protocol = atmelice_isp
Looking for upload port...
Using manually specified: usb
Forcing reset using 1200bps open/close on port usb
Waiting for the new upload port...
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.
I have a working Atmel ICE programmer:
$ lsusb | grep Atmel
Bus 001 Device 012: ID 03eb:2141 Atmel Corp. ICE debugger
Configuring upload protocol...
AVAILABLE: atmelice_isp
CURRENT: upload_protocol = atmelice_isp
Looking for upload port...
Using manually specified: usb
Uploading .pio/build/leonardo/firmware.hex
avrdude: usbdev_open(): WARNING: failed to set configuration 1: Device or resource busy
avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
There is a post at Unfreeze Your Atmel-ICE – Arduino Craft Corner about a custom avrdude version. Does the last command, adapated to avrdude -c atmelice_isp -p m32u4 -v -t , show something?
That’s not looking too good. It did find your device this time, but talking to the microcontroller failed completely. Either there is something wrong with the wiring between the AtmelICE and the target board or Atmel ICE firmware somehow has a fault or avrdude still has a fault. Sadly I have neither a Mac nor an Atmel ICE to further investigate this. The next recommended stop would be the avrdude programmers maybe. Issues · avrdudes/avrdude · GitHub
Before you open an issue there it might be worth compiling the very-latest avrdude version yourself and seeing if that created binary has the same problem. See Building AVRDUDE for macOS · avrdudes/avrdude Wiki · GitHub. Make sure to brew remove the old avrdude version.
If you have a folder with the built avrdude executable and the avrdude.conf (like in the CI build I showed above), you can add a package.json file to it with content
{
"name": "tool-avrdude",
"version": "1.70000.223005",
"description": "AVRDUDE is a utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers",
"keywords": [
"tools",
"uploader",
"microchip",
"avr"
],
"homepage": "http://savannah.nongnu.org/projects/avrdude",
"license": "GPL-2.0-or-later",
"system": [
"darwin_x86_64",
"darwin_arm64"
],
"repository": {
"type": "svn",
"url": "http://svn.savannah.gnu.org/viewvc/avrdude/"
}
}
and given that you have PlatformIO commands available in the CLI (guide) you can the execute pio package pack in that folder. This will give you a .tar.gz file. You can then get back to your PlatformIO project and make PlatformIO use this working version of avrdude by specifying the path to that package file
platform_packages =
tool-avrdude@file://<path to .tar.gz here>
(docs) in the platformio.ini using the file:// protocol.
Is it always the same byte position if you do it multiple times?
Usually the -e flag is supposed to get rid of that error by performing an erase beforehand. Does it work if you manually avrdude -e ... it on the commandline?
You know someway to performance a configuration to use ATMELICE in Microchip Studio and Platformio? The both at the same time… because I use Atmel Studio to debug in some cases since platformio is not possible.
I know that Atmel Studio require:
ATMEL-ICE CMSIS-DAP (Interface 0) as driver HID
ATMEL-ICE DATA GATEWAY (Interface 1) as driver WinUSB