Sorry I am guessing what you are asking for:
Are you asking, how to set the priority for doing something like: attachInterrupt(34, func, mode)....
And set the interrupt priority?
On T4.x, which the code starts up, the initial code (startup.c) will switch all of the IO pins to Fast mode (they go from GPIO1-4 to GPIO 6-9)
And in this mode, there is only one interrupt defined for all of the pins: IRQ_GPIO6789
The code in startup.c that changes it is:
Code:
#if defined(__IMXRT1062__)
// Use fast GPIO6, GPIO7, GPIO8, GPIO9
IOMUXC_GPR_GPR26 = 0xFFFFFFFF;
IOMUXC_GPR_GPR27 = 0xFFFFFFFF;
IOMUXC_GPR_GPR28 = 0xFFFFFFFF;
IOMUXC_GPR_GPR29 = 0xFFFFFFFF;
#endif
So you can use NVIC_SetPriority(irq, value) to set this to a higher priority (lower value) I believe they all start out at 128. So for example setting to 96 would give it a higher priority.
I don't remember the resolution of this value it is either something like the top 5 bits or the like. i.e. 128 and 129 are probably the same...
Now as has been mentioned in a few other threads. you can at times swith one or more pins back to reqular speed. So for example pin 34 is on Port 2 or 7 pin 29.
So you can update the appropriate bit in IOMUXC_GPR_GPR27 to 0 and have it back on GPIO 2
And with this, you will find there are two IRQs associated with GPIO2
Code:
IRQ_GPIO2_0_15 = 82,
IRQ_GPIO2_16_31 = 83,
So you could setup up your own interrupt for IRQ_GPIO2_16_31 and set it's priority. Likely you would only have one pin so it would not have to scan for which ones triggered.
Or there are some libraries out there to do frequency measurements. like FreqMeasure, but these work on specific pins.
Example for T4.x I believe this. is pin 22
FreqMeasureMulti - can handle this on a lot more pins. That is I believe any pin that has a FlexPWM timer associated with it. Unfortunately pin 34 is not one of them.