cgchas
Member level 3
- Joined
- Jul 19, 2011
- Messages
- 56
- Helped
- 2
- Reputation
- 8
- Reaction score
- 4
- Trophy points
- 1,288
- Activity points
- 2,001
I am looking for options for eliminating interrupt jitter on an 8-bit AVR such as the ATmega328p.
I am aware that if an interrupt occurs during execution of a multi-cycle instruction, this instruction is completed before the interrupt is served. This comes from 7.7.1 Interrupt Response Time, of the ATmega328p datasheet. Such is my case.
What are some good methods for knowing the CPU state before the interrupt triggers?
Various Google searches have yielded results suggesting sleeping the CPU from the main loop before the interrupt triggers. This is ok if the added wakeup latency is acceptable and if the AVR can be dedicated to the interrupt this way. But is there any other way?
For example, given a very small main loop, but not sleeping the CPU, is it possible to determine from the ISR, after the interrupt servicing has begun, what the last executed instruction was from the main loop or perhaps the last location of the program counter, before the jump? If so, this would allow for a deterministic timing correction, but I am not sure if it is possible.
Thanks in advance for any assistance.
I am aware that if an interrupt occurs during execution of a multi-cycle instruction, this instruction is completed before the interrupt is served. This comes from 7.7.1 Interrupt Response Time, of the ATmega328p datasheet. Such is my case.
What are some good methods for knowing the CPU state before the interrupt triggers?
Various Google searches have yielded results suggesting sleeping the CPU from the main loop before the interrupt triggers. This is ok if the added wakeup latency is acceptable and if the AVR can be dedicated to the interrupt this way. But is there any other way?
For example, given a very small main loop, but not sleeping the CPU, is it possible to determine from the ISR, after the interrupt servicing has begun, what the last executed instruction was from the main loop or perhaps the last location of the program counter, before the jump? If so, this would allow for a deterministic timing correction, but I am not sure if it is possible.
Thanks in advance for any assistance.