2

I have an MP3 development board I picked up from sparkfun that runs off the LPC2148 ARM processor. In looking through the code, I see a function to force a watchdog reset. My question is, how do you figure out what values to feed to the watchdog register? I looked through the LPC2148 data sheet and couldn't figure it out. I don't just want to use other people's code, I want to understand why they did what they did and how they figured out what to do.

flag

6 Answers

2

From the LPC23XX datasheet, should be the same for LPC2148 ::

Watchdog feed sequence register. Writing 0xAA followed by 0x55 to this register reloads the Watchdog timer with the value contained in WDTC.

link|flag
1

This is the code I use for an LPC2148:

WDTC = 0x00000FFF; // very short timeout

WDMOD = 0x03; // watchdog resets CPU

WDFEED = 0xAA; // start watchdog

WDFEED = 0x55;

link|flag
1

You need the User Manual! You won't find that stuff in the data sheet.

What don't you understand about my code? It's commented.

link|flag
He just wanted to know where those numbers came from. I doubt you bothered to comment the source of those constants (since they are right in the user manual!) – Michael Kohne Jan 8 at 14:08
1

Leon: that's the code I'm using. The thing is that I don't want to just use other people's code without understanding why it's being used. I understand the code just fine. What I don't understand is where the numbers came from.

Malkocoglu: is there a master NXP ARM datasheet I'm not seeing that tells you these things? How would I know to look in the LPC23XX datasheet, or is it just something you happen across?

EDIT: I found the actual user manual. All my searches before were just giving me the data sheet, the site for the kit that I was using just had the data sheet, and I wasn't aware that there was a user manual. I didn't realize that the data sheet and user manual were separate, now I get it. Thanks for the help!

link|flag
It took me a long time to find the "user manual" too for NXP parts. I looked at the datasheets before and just thought they were hugely lacking in detail. – John Burton Jul 21 at 8:50
1

0xAA and 0x55 are often used in this sort of code which affects an application in a big way, as they are unlikely to be encountered during normal code execution.

You'll find the LPC2000 Yahoo group very useful for this sort of question. It has over 8,000 members!

link|flag
0

It sounds like you're trying to force a watchdog reset, not keep the watchdog from resetting you. This is accomplished by a misfeed: feeding the watchdog 0xaa followed by a value OTHER than 0x55. Example:

WDFEED = 0xAA;    /* Correct feed... */
WDFEED = 0x00;    /* ... Oops, insta-reset! */
link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.