Arduino Due not yet working with Atmel-ICE

1. Related posts

A few people already tried to use the Atmel-ICE with the Arduino Due:

Unfortunately, these posts were closed without a solution being provided. So I open another one here :slight_smile:

2. Context

I'm in a team building this new IDE for microcontrollers:

https://embeetle.com

Currently, we're trying to support the Arduino Due in Embeetle. The functionality we added for other Arduino boards, generally consists of:

  • Flash firmware through the COM-port (default setting)
  • Flash firmware through an external device (eg. Atmel-ICE or AVR ISP mkII)
  • Flash bootloader through external device (eg. Atmel-ICE or AVR ISP mkII)

For the Arduino Due, I've successfully implemented the first functionality: flashing firmware through the COM-port. As for the other two functionalities, I just can't get it to work.

3. Flashing firmware through COM-port: works

Flashing firmware through the COM-port works fine. I simply observed what Arduino does when flashing the firmware, which is something like this:

bossac.exe -i
           -d
           --port=COM16
           -U false
           -e
           -w
           -v
           -b
           C:/Users/.../Blink.ino.bin
           -R

With that information, it wasn't difficult to implement something similar in Embeetle IDE.

4. Flashing firmware (and/or bootloader) through external device: doesn't work

Flashing firmware (application or a bootloader) through an external device doesn't work. In Arduino there's simply nothing available:

I tried adding the following code to the "C:/Users[Username]/AppData/Local/Arduino15/packages/arduino/hardware/sam/1.6.12/programmers.txt" file:

atprogram_atmelice_isp.name=Atmel Studio ATMEL-ICE (ISP)
atprogram_atmelice_isp.program.tool=atprogram
atprogram_atmelice_isp.program.extra_params=-t atmelice -i ISP
atprogram_atmelice_isp.help=Connect the programmer to the ICSP port 

The ATMEL-ICE shows up in the Arduino IDE, but it still doesn't work. It results in an error message:

Error while uploading: missing 'program.params.verbose' configuration parameter

I copied the code for programmers.txt from this post: Atmel-ICE with Arduino IDE ? - #2 by epinc

I don't know how to modify it, to solve the error.

5. Question

I'd like to know how to flash firmware (or a bootloader) to the Arduino Due through an external device (eg. Atmel-ICE). Preferrably with a shell command - a Windows cmd or Linux bash command. But if you can show me how to do it in the Arduino IDE, I can deduce the shell command later on by looking at the Arduino (verbose) output.

Hi @ard_newbie ,
Thank you for the video. I've tried to follow the steps, but Atmel/Microchip studio doesn't recognize my Atmel-ICE probe. So I'm basically blocked.

1. Microsoft Device Manager

As soon as I connect, my Atmel-ICE is present in the Microsoft Device Manager. It has three entries there:

1.1 Device Manager > Universal Serial Bus controllers > USB Composite Device

image

image

 

1.2 Device Manager > Microchip Tools > Atmel-ICE Data Gateway

image

 

1.3 Device Manager > libusb-win32 devices > Atmel-ICE CMSIS-DAP (Interface 0)

image

 

2. Atmel/Microchip studio

Despite the Atmel-ICE being visible in the Device Manager, Atmel/Microchip studio seems unable to connect to it. When I start the IDE, it shows this:

image

I click "Wait 1 more minute", but that doesn't seem to help much. When looking at the settings in my blinky-project, I see the following:

The only choice for "Tool" is "Custom Programming Tool". No Atmel-ICE to be seen...

What should I do?

 

3. Shell commands

In fact, I'm not even interested that much to get the Atmel-ICE working in Atmel/Microchip studio. My only motivation is observing the shell commands that are invoked to flash firmware to the Arduino DUE through the Atmel-ICE probe.

If you can show me the shell command(s) directly, that would be awesome. No need to debug anymore why Atmel/Microchip studio can't find the device :slight_smile:

Apart from the Arduino IDE, you can read or write a .bin file to/from a DUE after typing a "cmd" with Windows.

Once a cmd line is shown inside a window, copy one of these lines to read or write:

To read a .bin file inside the DUE:

Thru the programming port:
AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino\bossac.exe --port=COM4 -U true -r image.bin

Thru the Native USB port:
AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino\bossac -U true -r image.bin

To upload to the DUE a .bin file:

Firstly, push the Erase button for 3 seconds, then the Reset button for 3 seconds, then:

Thru the programming port:
AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino\bossac.exe --port=COM9 -U true -e -w -u -b image.bin

Thru the Native USB port:
AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino\bossac.exe -U true -e -w -u -b -R image.bin

Of course, the COM number might differ for you, or the arduino version 1.6.1 for me, and finally the .bin file name.