Archive

Posts Tagged ‘AVARICE’

My homemade AVR JTAG debugger.

December 10th, 2008

ATMega16 microcontroller: 160 Rupees.
Other Circuit components: 60 Rupees.
Solder wire:  15 Rupees.
AVR-GCC/AVR-GDB: Zero  (if you exclude the broadband cost of downloading)

The sense of satisfaction when I was finally able to debug AVR code on chip using my new homemade JTAG, over Linux: PRICELESS !!

Yes !! I was finally able to finish setting up my AVR development environment and let me tell you, the night I did it, I was not able to sleep due to excitement !

In my previous post, I had mentioned as to how I was able to come up with a minimal setup consisting of a programmer board and a general purpose development board for the Atmel AVR series of microcontrollers. Well, now that setup is complete, with the addition of a fully functional JTAG board. What this JTAG board allows me, is to examine my code execute at runtime on the actual hardware without incurring any execution overheads. It allows me to change variables at will, put breakpoints wherever I wish and inspect how my embedded program behaves. All these greatly increase my productivity as a programmer.

When I was working with the AT89S52 (an 8052 variant from Atmel) I did not have the luxury of on chip JTAG debugging and as a result I would spend hours trying to solve bugs which were very simple and would have got caught if I had some kind of on chip debugger. Solving bugs then was mainly by ‘thinking’ or by lighting up LEDs (in stead of ‘printf()’ statements that we use in our ‘normal’ programs for debugging).

The circuit schematics for this JTAG board are from the aquaticus ROV project site. And as usual I managed to take some photographs of this new JTAG board while I was constructing it.

Starting the construction of my JTAG board. Here you can see the IC bases of the MAX232 and the ATMega16 and the crystal being soldered on.

Starting the construction of my JTAG board. Here you can see the IC bases of the MAX232 and the ATMega16 along with the crystal soldered on the PCB.

With some more components soldered. Notice the USB connector for supplying power to the board directly from my PC USB and the JTAG connector.

With some more components soldered. Notice the USB connector for supplying power to the board directly from my PC USB and the JTAG connector.

The completed board. Notice the serial port connector at the bottom left corner and the actual ICs snapped onto the board finally. Also notice the 10 pin JTAG connecting ribbon to the right.

The completed board. Notice the serial port connector at the bottom left corner and the actual ICs snapped onto the board finally. Also notice the 10 pin JTAG connecting ribbon to the right.

The completed JTAG board in action. To its left, you can see my prototyping board. And further to the left I have a red LED connected to the pin 0 of port B. I am blinking this LED through a very small C program. The program execution can be stepped through using gdb in my host system.

The completed JTAG board in action. To its left, you can see my prototyping board. And further to the left I have a red LED connected to the pin 0 of port B. I am blinking this LED through a very small C program. The program execution can be stepped through using gdb in my host system.

And finally, my new JTAG board in action on my Linux host. The program source code is at the bottom left corner of the screen and behind in the terminal you can see AVARICE running in the background accepting connections from GDB. GDB, running within DDD GUI, is the top most window where you can clearly see a breakpoint being hit.

And finally, my new JTAG board in action on my Linux host. The program source code is at the bottom left corner of the screen and behind in the terminal, you can see AVARICE running in the background accepting connections from GDB. GDB, running within DDD GUI, is the top most window where you can clearly see a breakpoint being hit.

And also, here is a short video of by JTAG board in action:

Hope you liked this post. Stay tuned for more posts as I embark on a new journey of exploring the AVR microcontroller !

seemanta Embedded Hobbyist, My Creations, Tech , , , , , ,