We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I use AT89S52 in a project. I send and receive data through TXD, RXD pins to a GSM module for sending SMS to another mobile equipment. I use watchdog facility and the watchdog counter is reset at every 256 counts. My crystal frequency is 11.0592 MHz. It happens once in a while that the uC doesn't respond and remains as if it hangs. Then it has to be RESET again. I doubt whether it happens while serial data reception and sending happens simultaneously. I wrote the program in C using KEIL IDE. My questions are 1) What are the special precautions to be taken in this case?(sending and receiving simultaneously) 2)why this happens even when the watchdog is active? It will be highly appreciated if anybody can give some guidance.
Firstly, how are you sure that the Watchdog is active?
Even if it is active, all a Watchdog does is to cause a reset if it is not "updated" within its timeout.
If your Watchdog "update" scheme is flawed such that "updates" can occur even when the program is "stuck" - that will obviously allow this to happen.
See: www.8052.com/.../173972 www.8052.com/.../174030 www.8052.com/.../174042
assuming your watchdog is working and configured to reset the MCU, it is safe to assume that your program ends up in a condition in which it services the watchdog but not performing its main function.
I don't think that is a safe assumption.
That needs to be verified - not assumed!
Also that there is nothing that disables the Watchdog after it has been correctly started!
I use watchdog facility and the watchdog counter is reset at every 256 counts.
sounds like a watchdog update in a timer ISR which makes that watchdog TOTALLY useless
Erik
Not sure that it's necessarily totally useless - but would need careful consideration...
"makes that watchdog TOTALLY useless" Can you kindly elaborate this point or suggest some reading material to understand this point?
I thought of that possibility. But still unable to find out any reason.
That needs to be verified - not assumed! I checked with the debugger. How can I verify otherwise?
can you throw some light on the points to be considered.
"makes that watchdog TOTALLY useless" Can you kindly elaborate this point or suggest some reading material to understand this point? A processor can go far astray and still have the timers running, thus feeding the WD in a timer ISR will make the watchdog NOT bite even if the code run astray.
How, precisely, did you check?
Have you actually verified that, if you deliberately enter an infinite loop, the watchdog does cause a reset?
Remember: the only things we know about you or your project are those that you explicitly state in your posts.
Which possibility?
program ends up in a condition in which it services the watchdog but not performing its main function.
I updated WD in timer ISR. Now I think, it should not be like that.
Useful information. Thank you