??? 03/16/05 21:17 Read: times |
#89807 - Good Questions on ISR's Responding to: ???'s previous message |
Michael, thanks for your input. We have thought of most of these issues, but it is really good to be reminded that other developers are asking the same questions as we did. Responses below:
>Are any of your ISRs calling subroutines? Are the subroutines >called also from other places? No. Bad idea! >Do you "accidently" have a stack imbalence problem wherein the >RETI from the Timer ISR is somehow being missed under some >oddball combination of interrupt latencies and overlaps? We shouldnt. Interrupts are separate from the main code and are never called from main. The ISR's call no functions. They just increment variables, or store / send serial data. >Do you have global variables used in the ISRs that are also >accessed in the mainline code or in other ISRs that have >concurrency problems? (Ie one is being accessed while another >access has left say an INT value half updated). The timer ISR that stops does have a byte that is accesed in main, but since it is only a byte, we should be ok? >Do you have any SFR accesses going on that may have concurrency >issues wherein the same SFRs may be accessed for >read/writes/modifies by main line code and in ISRs? The only SFR's the ISR's change are related to interrupt flags, serial tx or rx registers. >Is a power cycle necessary to recover the supposedly "hung" >timer interrupt? Yes, this is the ONLY thing that fixes it. >Have you handled the WDT reset in a correct manner? Is there >something wierd going on with that? I have had unexpected WDT >activity bite my butt more times than I like to admit. The WDT is disabled. >Any of these types of problems can require an ambitious effort >to evaluate and make sure that it is not the source of a >problem. It is easy to say that "the software is right" but >hard to prove that it "IS Right" !! Your not wrong - this has been plaging us for a long time now. We have just managed to optimise our ISR's so we can handle the serial ports without having to use priority. This will have to be the fix for us I think. We cannot fathom what we are doing wrong because we now have 2 indepenant projects (coded by different people) that cause this issue. Thanks for your help it's much appreciated. |