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 guys,
I have a product based on an AT89C51 form Atmel and a lot of code on board (GSM Modem connection, I/O, CAN Interfaces etc). 99.99% of the time it is all fine and works reliably BUT very occasionally we get a crash.
We recover from it and restart successfully and in most cases no one even knows it happens.
I was wondering if anyone knows of any way of getting any crash data out of the 51? I have FRAM and EEPROM that could be usef for storage but the reset (of course) resets all the registers and any trace of the fault is lost.
Is there anyway of suspending the core here in the test lab so that we can catch the crash?
Cheers for any help,
Dirk
I don't know your chip, but maybe you can prevent a specific piece of RAM from being set to 0 at startup. you can save crash data there for later recovery, as long as power is not recycled.
It is normally very hard for the program to help with the above since the program will not know when it is about to crash. One thing is if the crash is caused by a stack overflow, it may possibly happen if you get an interrupt at a specific position in the code. Or it may happen if you have nested interrupts and get a specific sequence of interrupts. The problem with tracking interrupt-induced crashes, is that the crash normally happens after the interrupt returns. But if the ISR clears a flag when exiting, there will be no trace that the crash happened just after the ISR ended. And if the ISR doesn't clear a status flag, you will not know how long time since the last interrupt of that type.
One thing to consider, is to let all ISR write the stack pointer to a specific location in the FRAM and check the highwater mark after a crash and the highwater mark before a crash.
Thanks Per,
I get where you are coming from with this. It may point us in the right direction at least. I think this may take a little time to get working so I will let you know later on.
if the SP at the ISR entry is less than the startuo SP value go to PANIC if you have an ICE, or write to the FRAM .
I always have PANIC: jnb button,$ read the stack
this, of course only works when ICEing, when the debug flag is not set, I check at start and display "Crash at x...."
Erik