One quick way that I'm fond of is to write to an external one-byte buffer. I usually don't have the I/O lines to do a parallel write, but use a serial-in, parallel out part. Before every task spit out a byte that identifies what task is currently running. If the unit crashes I can look at what is in that buffer - If one has infinite resources you could put LEDs on the output so you have a visual indication, if you want to make it REALLY robust only allow a certain range of values to be written so a random call of the function won't write garbage out (if your code is OTL.) Sure, it takes up code and board space though. If you have a RTC on your board you could use the static RAM in the part for your storage of the debug/breadcrumb byte. But using I2C for this will take a LOT of time and might not be a great idea. Just a thought, DLC >> So how does one record information to determine where the bug might be >> in a >> situation where it is very difficult to reproduce the conditions that >> caused >> the software hang? >> >> I can have the application leave 'breadcrumbs' at different points but >> this >> would either take a lot of time to narrow in on or take a lot of >> 'breadcrumb' code. > > > I do this for some applications. > I have a task buffer and an ISR buffer, which are write-only circular > buffers. > Any significant task that starts (not one that gets called and decides > not to run) puts an entry in the task buffer. > Any ISR that starts puts an entry in the ISR buffer. > > On a reset, I can use the ice to breakpoint and read out the buffers. > In some apps, I've used the serial port to send "last task", "last > ISR" and "reason for reset" when it's waiting for the boot loader > magic word. > > It all depends on what you need, and how much ram you can spend on it. > > > -- > There is no computer problem which cannot be solved by proper > application of a sufficiently large hammer. > > > ------------------------------------ > > Yahoo! Groups Links > > > > -- Dennis Clark TTT Enterprises
Message
Re: [AVR-Chat] WatchDog Timer
2009-07-21 by Dennis Clark
Attachments
- No local attachments were found for this message.