Forum: ARM programming with GCC/GNU tools Watchdog on SAM7A3

von Jim K. (ancaritha)

Rate this post
0 useful
not useful
Hi everyone.  I've also posted this on the AT91 forums (incase anyone 
reads that as well), but as no one has responded I'm posting here as 

I'm having an issue with the configuring the watchdog to a certain mode. 
We have an issue in our system which causes it to log up and the 
watchdog fires, this resetting the system.  This works fine, but I'm 
trying to configure the watchdog to fire an interrupt instead so I can 
break at it and take a look at some stuff to try and figure out what 
exactly is breaking.  I seem to be failing at this though, so I was 
wondering if anyone would be able to point out the mistake that I'm 

// Setup watchdog

// Enable interrupt
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS, 

// Enable AIC to catch the interrupt

And then inside the ISR:

U32 nWatchdogStatus = AT91C_BASE_WDTC->WDTC_WDSR;
if (nWatchdogStatus)
   // put the below line in your ISR where you want the RESET...

I know the system interrupt part works as its the same interrupt that 
the PIT timer hits, but the watchdog never seems to enter it.  When the 
watchdog fires the system just hangs, it never hits the if statement. 
If I set up the watchdog to reset the system instead of cause an 
interrupt, it works fine.

Anyone got any ideas as to what I might be doing wrong?  Thanks!

von Jim K. (ancaritha)

Rate this post
0 useful
not useful
So I determined that if I set a while(1) loop and force the watchdog to 
fire, it properly creates the interrupt and catches it.  However, if 
instead of doing while(1) jump to address 0x0 (which causes the system 
to crash) the watchdog interrupt does not get triggered.

I believe this is what is happening in my code.  Somewhere, a bad 
pointer is being accessed, causing a jump to an invalid location and 
locking up the system.  Does anyone know a good way to look at the 
Program Counter and follow it?  I'm currently using the Watch command 
with GDB insight, watch $PC < 0x8000 (0x8000 is where my code starts), 
but whenever I do that my system seems to grind to a halt.  Stepping 
through my code line by line isn't going to work because the crashes 
aren't consistent and I don't even know where they might be occurring, 
so I need something that is automated that can just run and hopefully 
catch the crash.

Does anyone know a way to do this?


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.