Atmel ice cannot upload (but debug works)

When I set the atmel-ice as uploader I get an error

I run use PlatformIO, version 3.6.2 on Mac 10.14.1 with VSCode

Here is my platformio.ini :

    [env:adafruit_feather_m0]
    platform = atmelsam
    board = adafruit_feather_m0
    framework = arduino
    upload_protocol = atmel-ice

and the error

     Executing task: platformio run <

Processing adafruit_feather_m0 (platform: atmelsam; board: adafruit_feather_m0; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------
Error: Traceback (most recent call last):
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/__main__.py", line 120, in main
    cli(None, None, None)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/commands/run.py", line 107, in cli
    result = (envname, ep.process())
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/commands/run.py", line 207, in process
    result = self._run()
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/commands/run.py", line 313, in _run
    return p.run(build_vars, build_targets, self.silent, self.verbose)
  File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/managers/platform.py", line 353, in run
    self.configure_default_packages(variables, targets)
  File "/Users/***/.platformio/platforms/atmelsam/platform.py", line 48, in configure_default_packages
    self.packages["tool-bossac"]['version'] = "~1.10900.0"
KeyError: 'tool-bossac'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

The terminal process terminated with exit code: 1

Hi there
Anyone using Atmel-Ice as programmer ?

Does it work with the latest upstream version Atmel SAM — PlatformIO latest documentation? if yes, we will make a quick bug fix release.

not better

Processing upstream_develop (platform: https://github.com/platformio/platform-atmelsam.git; board: adafruit_feather_m0; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
KeyError: 'tool-bossac':
File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/builder/main.py", line 169:
env.SConscript("$BUILD_SCRIPT")
File "/Users/***/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/Users/***/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
exec _file_ in call_stack[-1].globals
File "/Users/***/.platformio/platforms/atmelsam@src-6137f7e004c0457aa63b2eb976584bd1/builder/main.py", line 51:
platform = env.PioPlatform()
File "/Users/***/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/Users/***/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/pioplatform.py", line 40:
p.configure_default_packages(variables, COMMAND_LINE_TARGETS)
File "/Users/***/.platformio/platforms/atmelsam@src-6137f7e004c0457aa63b2eb976584bd1/platform.py", line 49:
self.packages["tool-bossac"]['version'] = "~1.10900.0"
================================================================== [ERROR] Took 0.38 seconds ==================================================================
The terminal process terminated with exit code: 1

Thanks! I finally reproduced this issue. Please uninstall dev/upstream version of dev platform via PIO Home > Platforms > Installed > Search for Atmel SAM which has GIT revision > Uninstall

Then, use stable platform = atmelsam. We have just published a new release. See Release 3.4.2 · platformio/platform-atmelsam · GitHub

I confirm : it’s working thanks a lot !

Does debugging work too?

Yes it does,

(Sorry I thought I had posted this answer already)

1 Like

Hello, I’ve been trying to use atmel-ice with platformio but i always get this error (Looking for upload port…
Error: Please specify upload_port for environment or use global --upload-port option.
For some development platforms it can be a USB flash drive (i.e. /media//)
*** [upload] Explicit exit, status 1)

and this is what i have on my platformio ini file
[env:nanoatmega328]

lib_extra_dirs = ~/Programs/arduino-1.8.8/libraries

platform = atmelavr

framework = arduino

board = nanoatmega328

upload_protocol = atmelice_isp

debug_tool = atmelice_isp

I don’t see any documentation here on uploading on Atmel AVR — PlatformIO latest documentation

but i know it is working because if I type avrdude -c atmelice_isp -pm328p i get
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)

avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done. Thank you.

I can debug my codes with no problem using attiny85 i want to do the same with arduino nano ps i can do it with arduino IDE but i would rather do it with platformio.

please let me know if you can help me with this issue

As far as debugging, you won’t have much luck, as it looks like the ICE is only good for SAM debugging with platformio, as only the SAM framework is listed against it, and it is specifically listed that the unified debugger does not support Arduino Nano

However, I don’t know why you can’t get the programming to work… All I can suggest is it’s a discrepancy because platformio uses atmel-ice to described the Atmel ICE unit, whereas avrdude is looking for atmelice_isp? I’ll have to try again on linux, as I believe I have an issue that stems from how the drivers behaved at some point… as I’mg getting avrdude.exe: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2141 avrdude (even though that is the VID/PID of the atmel-ice), the Arduino IDE won’t program, but Atmel Studio 7 is working just fine! :pineapple:

You can get started with debugging using Debug probe support for atmel-ice / dragon and atmega328p processor · Issue #53 · platformio/platform-atmelavr · GitHub and uploading by writing a custom upload tool using Redirecting...; I don’t currently see it implemented, but writing a script that invokes avrdude with atmelice_isp also doesn’t seem too hard

Also your

differs from

This does work on Linux with the Atmel ICE and ‘Upload using Programmer’ as it is the correct name that avrdude is looking for. For some reason it isn’t working for me on Window, but I can see mention of it on other forums as being related to driver changes by Atmel. :-/

btw, there’s a semicolon on the end of custom-upload-tool link that shouldn’t be there :wink:

The following also worked fine for me on linux - use the upload command, not upload with programmer - so I would expect to work just fine on Windows with a change to the correct path for avrdude. I didn’t use the $UPLOADERFLAGS and specify the avrdude flags in the platformio.ini file as I had an issue with the platformio default flags being appended also.

=== platformio.ini ===
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
extra_scripts = upload_atmel-ice.py
upload_protocol = custom
=== upload_atmel-ice.py ===
Import("env")
env.Replace(UPLOADHEXCMD='$UPLOADER -p atmega328p -C /home/pfeerick/.platformio/packages/tool-avrdude/avrdude.conf -c atmelice_isp -U flash:w:$SOURCES:i')

Edit: Well, Windows is ‘working’ in as far as it’s trying to do the upload, but until I work out how to sort out the driver (will be poking with zadig to see if that can break something) it doesn’t help me. However, for some reason, I had to add upload_port = none to the platformio.ini for the Windows upload to not fail flat on its face with:

Configuring upload protocol...
AVAILABLE: custom
CURRENT: upload_protocol = custom
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
=== Windows upload_atmel-ice.py ===
Import("env")
env.Replace(UPLOADHEXCMD='$UPLOADER -p atmega328p -C C:/Users/Peter/.platformio/packages/tool-avrdude/avrdude.conf -c atmelice_isp -U flash:w:$SOURCES:i')

Note: I used forward instead of backslashes as normal for the path in windows to avoid escaping…

Later edit: Zadig fixed the issue on windows with avrdude not detecting the atmel-ice - just replaced the “Atmel-ICE CMSIS-DAP” WinUSB driver with libusb-win32, and it works fine. Atmel studio doesn’t like it, but it will be just a matter of swapping the drivers back if I want to use it.

I also removed both the upload_port and upload_protocol commands from platformio.ini on windows, as since I’m complete replacing the avrdude call, it wasn’t needed. I’d probably keep the upload_port in the platformio.ini in future though, and set it to custom, just to make it a bit more obvious what’s happening. It just seems that you need to set upload_port if you have upload_protocol set though (one windows).

Thanks for taking the time to look into my issue, I finally got it to work, i haven’t try this on windows but i’m sure it’ll be the same

1 Like

Can you indicate exactly what you did to make the atmel-ice be able to program the attiny85?

Thanks,

Rich

This thread is about uploading to an SAMD21G18 ARM device – please open a new thread with your current `platformio.ini´ and error message (if any).