reset + at91sam7x

Hello there!

I found a very interesting thing, so I think I write here and I hope it will help those people who will meet this kind of problem in the future.

I have YAGARTO; AMONTEC JTAGKey Tiny USB debugger and AT91SAM7XC256 target on myself designed “devboard”. I 've dowloaded Atmel GCC example sources and James P. Lynch tutorial from Atmel website. I 've followed the instructrions in Lynch’s tutorial and I was able to download my program to the uC’s flash (this program is a modified version of the Atmel’s example). The program worked fine, but I couldn’t debug from the flash.

The problem is caused by the micro reset controller. To start the debug session, first you have to do a soft reset which will clear the PC, but don’t reset the peripherals. So any pending interrupt can cause Undefinied exceptions, etc. For a proper reset you have to reset the peripherals too. This can do by this instruction in the debugger ‘Run’ commands, after softver_reset_halt line: monitor mww 0xfffffd00 0xa5000004

-mww an OCD command

-0xfffffd00 reset controller register in Atmel AT91SAM7X series

-0xa5000004 this is the value (a5 the key, 4 - Peripheral Reset)

Now, with this line the flash debug runs fine too.

If you want to use a runtime reset, you will have to enable user reset after any power cycling (unfortunately user reset is disabled in default settings): mww 0xfffffd08 0xa5000001

-0xfffffd08 reset controller mode register in AT91SAM7XC series

-0xa5000001 this is the value (a5 the key, 1 - user reset enable)

Sorry for my English, but I think it is easy to understand the above lines. :smiley:

Regards,

Istvan