2013年12月1日 星期日

Arduino Jtag Debug (Mega2560)

1. Prepare
#Hardware
Arduino Mega 2560
Atmel ICE
#Software
Atmel Studio 7 install
Arduino IDE install

2.
Atmel ICE connect to Arduino Mega ICSP
http://www.mediafire.com/view/a71l9uk08k4s3va/atmel_00.png

3.
Atmel Studio 7 -> Tools -> Device programming
[Tool]: Atmel-ICE
[Device]: ATmega2560

(tab)
[Interface settings]:
ISP Clock
http://www.mediafire.com/view/6969afjo23jsruy/atmel_01.png

(tab)
[Fuses]
#Enable
HIGH.OCDEN
HIGH.JTAGEN
#then click button
Program
http://www.mediafire.com/view/wiru2l3glj4bltz/atmel_02.png

4.
Atmel ICE and Mega 2560 power off, remove ICSP connector.
refer to Jtag circuit, using JTAG connector.
http://www.mediafire.com/view/ayyolatz821lour/atmel_03.png

5.
Arduino IDE
create a project, save name is sketch_jul17a.ino

6.
Atmel Studio 7 -> File -> New -> Project
[C/C++]:
#select
Create project from Arduino sketch
#press OK

Create C++ project from Arduino sketch
[Sketch File]: xxx\sketch_jul17a.ino
[Device]: ATmega2560
http://www.mediafire.com/view/vosx7jr9io86kwq/atmel_04.png

7.
right click project -> Properties
[Selected debugger/programmer]: Atmel-ICE
[Interface]: JTAG

8.
set breakpoint then start Debugging

Reference:
1. https://www.avrfreaks.net/forum/atmel-ice-and-arduino-atmega-2560-board
2. http://forum.arduino.cc/index.php?topic=277432.0
3. http://naoki.at/how-to-debug-arduino-mega-on-board-with-atmel-ice-and-atmel-studio-7-via-jtag

1 則留言: