EmbeddedRelated.com
Forums

LPC21xx Debugging with watchdog enabled

Started by Ananda Regmi October 31, 2011
Greetings,

Has somebody discovered a way to debug with debugger enabled on LPC2106?
Reading through what google could find, it seems like it is not possible to
disable the watchdog just for debugging.

I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
I can debug it fine if I comment out my watchdog initialization routine.
But, if I leave it in the code, it resets and I can continue with debugging.

Any ideas??

-Ananda


An Engineer's Guide to the LPC2100 Series

On Mon, 31 Oct 2011 15:15:57 -0600, you wrote:

>Greetings,
>
>Has somebody discovered a way to debug with debugger enabled on LPC2106?
>Reading through what google could find, it seems like it is not possible to
>disable the watchdog just for debugging.
>
>I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
>I can debug it fine if I comment out my watchdog initialization routine.
>But, if I leave it in the code, it resets and I can continue with debugging.
>
>Any ideas??
>
>-Ananda

Not sure if you can do it on the 2106 but on the 213x you can read a bit (PINSEL2 bit 2) to
determine if the pins are in JTAG mode, so you can disable the WDT at runtime if the debugger is
being used
>
>
>
>
Thanks Mike.. That was indeed a good idea. But, unfortunately, DBGSEL in
LPC2106 is not hooked to any I/O port. Besides that I am using LPC2106 with
the secondary JTAG and when using the secondary JTAG, DGSSEL does not need
to be shorted.

I did figure out a way to handle it though. We are setting our watchdog to
about 1.5 seconds. So, now after hitting the first breakpoint, I load the
WDTC register with 0xFFFFFFFF which sets watchdog timeout period to be
about 5 mins. So, that gives me plenty of time to debug.

Thanks for your input though.

-Ananda

On Mon, Oct 31, 2011 at 4:09 PM, Mike Harrison wrote:

> **
> On Mon, 31 Oct 2011 15:15:57 -0600, you wrote:
>
> >Greetings,
> >
> >Has somebody discovered a way to debug with debugger enabled on LPC2106?
> >Reading through what google could find, it seems like it is not possible
> to
> >disable the watchdog just for debugging.
> >
> >I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
> >I can debug it fine if I comment out my watchdog initialization routine.
> >But, if I leave it in the code, it resets and I can continue with
> debugging.
> >
> >Any ideas??
> >
> >-Ananda
>
> Not sure if you can do it on the 2106 but on the 213x you can read a bit
> (PINSEL2 bit 2) to
> determine if the pins are in JTAG mode, so you can disable the WDT at
> runtime if the debugger is
> being used
>
> >
> >
> >
> >
> >
> >
> >
> >
I had the same issue with the 2106. IIRC, the JTAG I use (J-Link) cannot disable the watchdog. There were some application notes on this from IAR.

Seems to me that I found that you just cannot debug with breakpoints with the watchdog enabled. And to disable the watchdog, you have to run special code to force a watchdog timeout which resets the CPU, then you don't again enable the the watchdog. So the debugging with breakpoints code has to differ at the source code level.

PITA, eh?

steve
Greetings,
>
>Has somebody discovered a way to debug with debugger enabled on LPC2106?
>Reading through what google could find, it seems like it is not possible to
>disable the watchdog just for debugging.
>
>I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
>I can debug it fine if I comment out my watchdog initialization routine.
>But, if I leave it in the code, it resets and I can continue with debugging.
>
>Any ideas??
>
>-Ananda
>
>
>
--- In l..., childresss@... wrote:
>
> I had the same issue with the 2106. IIRC, the JTAG I use (J-Link) cannot disable the watchdog. There were some application notes on this from IAR.
>
> Seems to me that I found that you just cannot debug with breakpoints with the watchdog enabled. And to disable the watchdog, you have to run special code to force a watchdog timeout which resets the CPU, then you don't again enable the the watchdog. So the debugging with breakpoints code has to differ at the source code level.
>
> PITA, eh?
>
> steve

i am following the last few posts in hope that i can learn something but no hope :)

back to books until the development board i ordered arrive.
cheers guys

On Tue, 01 Nov 2011 23:10:51 -0400, you wrote:

>I had the same issue with the 2106. IIRC, the JTAG I use (J-Link) cannot disable the watchdog. There were some application notes on this from IAR.
>
>Seems to me that I found that you just cannot debug with breakpoints with the watchdog enabled. And to disable the watchdog, you have to run special code to force a watchdog timeout which resets the CPU, then you don't again enable the the watchdog. So the debugging with breakpoints code has to differ at the source code level.
>
>PITA, eh?
>
>steve
>

One option, if you have a spare IO pin and a spare pin on your JTAG connector, is simply sense
whether there is anything connected to the debug port and not enable the WDT if there is,
>Greetings,
>>
>>Has somebody discovered a way to debug with debugger enabled on LPC2106?
>>Reading through what google could find, it seems like it is not possible to
>>disable the watchdog just for debugging.
>>
>>I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
>>I can debug it fine if I comment out my watchdog initialization routine.
>>But, if I leave it in the code, it resets and I can continue with debugging.
>>
>>Any ideas??
>>
>>-Ananda
>>
>>
>>
>
On processors without a DBGSEL signal, I wait for 30 seconds to enable the watchdog. The wait time is initialized in RAM on power up, and I can change it with the debugger to say 0xFFFFFFFF seconds if I want.

However, a lot of the debug stuff you do is in the first few seconds of operation anyway, so it doesn't matter that much.

-Hershel

--- In l..., Ananda Regmi wrote:
>
> Thanks Mike.. That was indeed a good idea. But, unfortunately, DBGSEL in
> LPC2106 is not hooked to any I/O port. Besides that I am using LPC2106 with
> the secondary JTAG and when using the secondary JTAG, DGSSEL does not need
> to be shorted.
>
> I did figure out a way to handle it though. We are setting our watchdog to
> about 1.5 seconds. So, now after hitting the first breakpoint, I load the
> WDTC register with 0xFFFFFFFF which sets watchdog timeout period to be
> about 5 mins. So, that gives me plenty of time to debug.
>
> Thanks for your input though.
>
> -Ananda
>
> On Mon, Oct 31, 2011 at 4:09 PM, Mike Harrison wrote:
>
> > **
> >
> >
> > On Mon, 31 Oct 2011 15:15:57 -0600, you wrote:
> >
> > >Greetings,
> > >
> > >Has somebody discovered a way to debug with debugger enabled on LPC2106?
> > >Reading through what google could find, it seems like it is not possible
> > to
> > >disable the watchdog just for debugging.
> > >
> > >I am using an Amontec JTAGtiny with openocd V0.4 to debug LPC2106 program.
> > >I can debug it fine if I comment out my watchdog initialization routine.
> > >But, if I leave it in the code, it resets and I can continue with
> > debugging.
> > >
> > >Any ideas??
> > >
> > >-Ananda
> >
> > Not sure if you can do it on the 2106 but on the 213x you can read a bit
> > (PINSEL2 bit 2) to
> > determine if the pins are in JTAG mode, so you can disable the WDT at
> > runtime if the debugger is
> > being used
> >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >