Debugging the 3pi using AVaRICE and avr-gdb

Has anyone be able to get AVaRICE and avg-gdb working from the command line for a 3pi/Orangutan? (on a Mac/Leopard)

Here is my command line:

avarice --program --file test.elf --part atmega168 --jtag /dev/tty.Pololu :4242

Here is the error:


AVaRICE version 2.7, Jul 21 2008 19:52:15

Defaulting JTAG bitrate to 1 MHz. Make sure that the target
frequency is at least 4 MHz or you will likely encounter failures
controlling the target.

JTAG config starting.
Failed to synchronise with the JTAG ICE (is it connected and powered?)

thx!
–Carl–

Hello, Carl.

Have you ever programmed an ATmega168 with your current setup? The mega168 doesn’t support JTAG; the only available in-circuit debugging interface is debugWire, which works via the reset line, and you would need to modify the 3pi slightly to make it work. Can you explain how you have your programmer connected?

- Ben

I am using the Orangutan (via USB) attached to the 3pi.

Maybe I am asking the wrong question.

I am looking for a ‘C’ debugger that will allow me to step through my program code running on the 3pi.

Is something like the ATMEL DebugWire (AT90JTAGICE-MK2) the device that would be needed to do this?

–Carl–

I need to correct something.

I don’t absolutely need to debug running code on the 3pi. If I can use a simulator to do this, that would be fine. I am looking through the docs for SimulAVR now. If this will work, let me know. If you have a guide for how to use this tool, please let me know.

thx!
–Carl–

Unfortunately, Simulavr doesn’t support the mega168. I’ll let Ben comment more on how to use debugwire, if you really want to go that way.

Hello.

AVR Studio has a simulator that will let you step through your code and test various conditions. It sounds like this would be more than sufficient for your needs, but, unfortunately, it only runs on Windows. If you want to pursue in-circuit debugging, you will need to use debugWire, which interacts with the ATmega168 via its reset line. To do this, you will need to use a programmer that supports debugWire (our Orangutan USB programmer does not), enable the debugWire fuse, and remove the filter capacitor that is on the 3pi’s reset line. I only recommend using debugWire if you know what you are doing, because once you enable the debugWire fuse, you will only be able to use debugWire to talk to your 3pi (and you will only be able to restore it to its normal ISP-responsive state using debugWire).

- Ben