How to debug Arduino Mega on board with Atmel ICE and Atmel Studio 7 via JTAG


Arduino is world wide platform for pretty handy embedded programming. Usually Arduino IDE is enough for your small weekend projects but sometimes you may need to tackle with a rather big project such as open source Arduino project like Marlin, which is one of most typical 3D printer firmwares.

Thankfully Atmel provides with native on board debugger for Arduino boards with Atmel Studio 7. Here is how.

  • What you need
    • Arduino Mega
    • Windows PC with Atmel Studio 7
      • AS is currently only for Windows
    • Atmel ICE or some compatible debuggers
    • Breakout board for JTAG interface
      • Because Arduino Mega board doesn’t have JTAG pins initially, you need a conversion board like this. ICSP pins are not for debugging but for programming.
      • My eagle board and schematic for 50mil (half pitch) 2×5 SMD pins are available as well here. SRST/TRST shorts aren’t necessary in my case.
  • How to connect them allimg_3085
  • Software Settings on Atmel Studio
    • Run Atmel Studio 7.
    • Connect Arduino Mega and Atmel ICE via ICSP and PC via USB.
    • Go to Tools>Device programming and open Fuses tab.
    • See if JTAGEN and OCDEN is marked and if no enable them and flash the fuse settings. Ignore the meaningless warnings if any.
    • Connect Atmel ICE and Arduino Mega board via JTAG. Now you’re ready for neat and smooth debugging!

 

Leave a Reply

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