What happens when a 9S08GB32 executes a STOP intruction when the IRQ pin is low?
We use stop1 in our product for the very, very low power consumption it offers and use IRQ to wake it up. Normally everything is fine but we have found that if conditions are "just so" and our shutdown logic executes, the code may inadvertently run the stop instruction when IRQ is still low. It appears to me that the micro doesn't actually stop and re-start as if a POR occured but may continue executing at the instruction following the stop opcode.
This makes bad things happen in our code... We're working to correct the code to prevent this but I'm wondering if someone has any information on what the uC actually does when IRQ is already low and stop executes.
Thanks.
Added p/n to subject.
Thanks for the reply.
bigmac wrote:Hello,By default, the external IRQ interrupt is negative edge triggered. This means that the next interrupt will not recur until the pin goes high, and then again low. It is possible to configure for both edge and level sensitivity, but this might present other issues that would need to be addressed - the repeated re-entry to the ISR code whilst the IRQ pin remains low.For some stop modes, the execution of the wakeup source ISR, then followed by execution of the instruction following the STOP instruction, is normal. If you always require a reset following stop, independent of the stop mode entered, the code immediately after STOP should force a reset. The illegal opcode method might be appropriate here.By the way, it is very important that the STOP instruction never be placed within any ISR code. This is because interrupts are automatically globally enabled prior to entering stop mode.Regards,Mac
Message Edited by bigmac on 2008-07-18 11:09 AM
. . . //force a soft reset DisableInterrupts;asm{ ldhx $fffe ;get POR vector jmp ,x ;pass control there }//asm