Atmel-ICE with macOS Catalina

Hi,
I want to use an Atmel-ICE as a programmer on macOS Catalina (10.15.7)

With AVRDude I have no problems:
$avrdude -c atmelice_isp -p ATmega2560 -v
can find the Atmel-ICE device:
avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J41800033909

But when I try to use the Atmel-ICE with PlatformIO it fails.

My platformio.ini:
[env:megaatmega2560]
platform = atmelavr
framework=arduino
board = megaatmega2560
upload_protocol = atmelice_isp
upload_port = usb

results into:
could not open port usb: [Errno 2] No such file or directory: 'usb'

Without upload_port = usb the error is:
Looking for upload port...
Error: Please specify 'upload_port' for environment or use global '--upload-port' option.

Does anybody know a solution?

salute
Thomas

PS: I already followed these signed dummy kext instructions without any luck

Per Upload and Debug for ATmega328P with Atmel ICE - #6 by maxgerhardt you should try adding

board_upload.require_upload_port = no

to the platformio.ini while removing upload_port = usb and retry.

YMMD!

Thanks a lot!
I wonder, why this is not mentioned at
https://docs.platformio.org/en/latest/plus/debug-tools/atmel-ice.html

Indeed it should be added to those docs, but the main docs for “How to program an AVR with a programmer” are at Atmel AVR — PlatformIO latest documentation – the Atmel-ICE is not explicitly mentioned there (which it also should be), but the “usual” way would be to use upload_protocol = custom and then fill in the upload_command and upload_flags value which are correct for the Atmel-ICE (most importantly -c atmelice_isp).

That this works is kind of a side-effect and not actually indended. As you can read in the doc you’ve linked yourself, the supported platform is Atmel SAM, not Atmel AVR, which is what you’re using the programmer for at the moment.

The platform-atmelavr scripts work however in a way that take the upload_protocol = xyz value and use in the -c xyz invocation of avrdude. Which partly works, if it wasn’t for the check that expects a serial device and its existence before upload (require_upload_port).

So actually for stability, i’d recommend more

board_upload.require_upload_port = no
upload_protocol = custom
upload_port = usb
upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    atmelice_isp 
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

which is the lengthier way of doing it.

Thanks a lot for all this information! I was searching a couple of days for all of it … seems not so many people are using Atmel-ICE on macOS with PlatformIO.
If you will stay in Berlin I’ll spend you a beer :slight_smile:

PS:
Wow! If I do a google search like "require_upload_port" site:docs.platformio.org it doesn’t show any result.
Is there any equivalent platformio.ini entry for debugging?

1 Like

Thank you. After searching several days on the net you finally offer me the solution. It works very well on mac OS Big Sure

Changing upload_port = usb to board_upload.require_upload_port = no
helped me and saved time.