What interrupts have higher priority than pin Interrupt? Does timer or USB interrupt have a higher priority then pin interrupt? Is there a way to set the pin interrupt as the highest priority?
Use of the priority and hard keywords in Pin.irq cause TypeError: extra keyword arguments given
Would it be possible to add the priority to the pin Interrupt? It looks like it is supported by micropython on the RT1062. The pin interrupt appears to be superceded by a timer interrupt that is causing issues.
So, CSI and USB have a higher priority interrupt. The camera driver for the RT1062 interrupts the processor per line coming in from the camera. This is likely why you are seeing some sort of delay.
The camera interrupts need to be processed though otherwise the frame grabber will miss a line and have to drop a frame. Similarly, for USB, it’s important the processor is responsive to these.
What are you trying to do such that the interrupt on the rising edge has to have perfect timing?
Adding hard=True causes TypeError: extra keyword arguments
I’m using both timer interrupt and pin Interrupt and the timer interrupt appears to have a higher priority than the pin, but I need the pin to take priority.
Mmm, machine timers are all through the systick interrupt, which has the highest priority out of all interrupts. You definitely don’t want to change the systick priority.
So, I guess you need to see the pin interrupt while the timer interrupt is happening?
This is one of those priority inversion issues…
Can you use micropython.schedule() in the timer interrupt to defer the execution of the code in that interrupt out of interrupt time? This will then allow you to receive the pin interrupt because the timer interrupt will quickly exit.