This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I'm currently using ADC interrupts, but I also want to use GPIO interrupts.
However, I can't find how to set the ADC interrupt priority, which should be higher than the GPIO interrupt priority.
If an ADC interrupt ISR is in progress and a GPIO interrupt occurs, does the GPIO ISR wait for the ADC ISR to finish before executing, or does it not execute?
Can you tell me how it works?
If there is a reference regarding that, please let me know
thank you,
Hi sygo,
Please refer to the Vectored Interrupt Manager(VIM) Section 10.2.1 of AM263x Technical Reference Manual to configure interrupts.
Q. If an ADC interrupt ISR is in progress and a GPIO interrupt occurs, does the GPIO ISR wait for the ADC ISR to finish before executing, or does it not execute?
If current interrupt has higher priority:
It will service the first ISR. During this ISR execution, the CPU mode is changed from IRQ mode to SVC mode so the newer interrupts can be accepted. If the current ISR interrupt priority is higher than the new request VIM will not accept the interrupt at all.
What happens to the interrupt which was not accepted ? It will still be set in the IP till the current ISR execution is in progress. When the IRQ is completed it sends an ACK to VIM, the VIM assumes the IRQ execution is completed and after the same it also moves the CPU mode back from SVC to IRQ and then back to SYS/USR mode.
If current interrupt has lower priority:
If prior to this interrupt being cleared another interrupt of higher priority arrives, then the FIQn/IRQn is
asserted and that interrupt is made pending as normal. If the CPU switches this interrupt to active, then the currently active interrupt is pushed onto a
stack. When an interrupt is cleared by reading the MSS_VIM_FIQVEC / MSS_VIM_IRQVEC register, if there
are any interrupts on the stack, the first entry is popped off and put back into the MSS_VIM_ACTFIQ /
MSS_VIM_ACTIRQ register, so that software retains original context and continues previous operation.
So, the GPIO ISR will wait for ADC ISR to finish before executing if priority of ADC interrupt is high, else if gpio interrupt has higher priority it will push ADC interrupt to stack and execute GPIO interrupt first.
Regards,
Akshit