Debugging with the new Atmel ICE

By | 5. August 2014

Atmel has a new version of their “budget” ICE available. It comes in three flavours: “bare” PCB, “basic” Case + simple cable, Case + multiple adapters. It seems to support any protocol you might have heard of

I got the basic version for around EU47 – not too bad. It comes with a micro USB and a JTAG cable with both a 50mil/10pin (suited for the Due) and a 100mil/6pin connector (for the Uno) – but no documentation at all – not a single sheet!

Documentation is only available online and a s a PDF.

Connecting

I couldn’t find any docs/images (even online!) on how to actually connect it to an Uno – looking at the pin1-marker on the ICE case and the Uno docs for its ICSP connector i did figure it out:

The red wire/pin1 is aligned to the left on the ICE (there is a marker in the blue frame). The coding nose on the 6pin connector is pointing towards Uno’s reset button (this works for me – no guarantee!).

Arduino Uno

The PC immediately recognises the ICE and can read the arduino’s avr settings on the “Tools/Device Programming” via ISP.

Then i tried to start a debug session: “You cannot debug via ISP. Only the device is programmed. Use debugWIRE for debugging …”.

Ok. Program only … program running. But the arduino bootloader (enabling uploading via arduino’s USB) was gone …

Hmmh. I had seen the DWEN Fuse on the “Tools/Device Programming/Fuses” tab and enabled it. The fuse was set immediately and i couldn’t access any of the ISP features anymore! Shock! Arduino bricked!

On the projects settings on the “Tool” tab, there is a setting for ISP or debugWIRE. Enabled debugWIRE – then i could upload AND debug my application – although transfer is a bit on the slow side. Yay!

The way back to ISP is a bit hidden: start debugging first, then click “Tools/disable debugWIRE and close”. Now you can access “Tools/Device Programming/Fuses” again and clear DWEN. But remember, this procedure isn’t a permanent thing!

To bring back the arduino bootloader, open “Tools/Device Programming” in Atmel Studio, apply the tool settings and read back the “Device Signature”. Then on the “Memory” pane, select the standard arduino bootloader from your arduino software install “<drive+path_to_arduino_sw_install>hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex” and program it. Finally, set the fuses like in the picture:

Btw, this partially overwrites the program you were running before going back to standard arduino – so don’t expect it to be still working.

Btw, compiling my current grbl code gives two significantly different sizes:

  • Atmel Studio: 28672 Bytes
  • Eclipse + Arduino: 30200 Bytes

That’s something that i’ll have to look into – especially because the arduino bootloader blocks another ~2KB.

Arduino Due

First issue: had to shorten the plastic of the 4pin/100mil connector labeled “DEBUG”, otherwise the 10pin/50mil connector wouldn’t fit.

Being more cautious on second try: “just looking” with the “Device Programming” … seems to work.

It seems the Due is using the SAM3X8E builtin ROM bootloader (which can’t be overwritten) to manage uploads – one way less to brick the device …

Now going for a test program: the atmel studio pwm led compiled and uploads ok. I also get the debug message/build info on the serial console – good. I can also debug the program – breakpoints, memory dumps & single-stepping works. But i can’t make anything happen on the leds. The hardware pwm (which is supported by asf) isn’t connected to the LED on PB27. 🙁

Switching back to the Arduino IDE: still works – no bootloader magic required!

2 thoughts on “Debugging with the new Atmel ICE

  1. Chic Thomson

    I assume that you were using the AVR socket on the ATMEL ICE for the UNO, and the SAM socket on the ICE for the DUE ?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *