Sorry hard to know what is going on, without information.
Like: 6 encoders counting pulses with what? Are you using a library? What interrupts? How do you know if you are losing interrupts?
Things like do these encoders have two IO pins on each? Are you using 0, 1, or 2 interrupt per encoder?
https://www.pjrc.com/teensy/td_libs_Encoder.html
Note: on T4.x, by default all IO pin interrupts: attachInterrupt(pin, ...) funnel through one Interrupt: IRQ_GPIO6789 = 157, // RT1060 only
That is all GPIO pins which are set to run at the high speed (Ports6-9) all use this one interrupt vector.
The one interrupt will try to process all of the pins which triggered before it returns... That is:
Code:
FASTRUN static inline __attribute__((always_inline))
inline void irq_anyport(volatile uint32_t *gpio, voidFuncPtr *table)
{
uint32_t status = gpio[ISR_INDEX] & gpio[IMR_INDEX];
if (status) {
gpio[ISR_INDEX] = status;
while (status) {
uint32_t index = __builtin_ctz(status);
table[index]();
status = status & ~(1 << index);
//status = status & (status - 1);
}
}
}
FASTRUN
void irq_gpio6789(void)
{
irq_anyport(&GPIO6_DR, isr_table_gpio1);
irq_anyport(&GPIO7_DR, isr_table_gpio2);
irq_anyport(&GPIO8_DR, isr_table_gpio3);
irq_anyport(&GPIO9_DR, isr_table_gpio4);
}
At one point I experimented with switching some of the IO pins back to normal mode (Ports 1-4), This is controlled by 4 IOMUXC registers that we set in startup.c
Code:
// Use fast GPIO6, GPIO7, GPIO8, GPIO9
IOMUXC_GPR_GPR26 = 0xFFFFFFFF;
IOMUXC_GPR_GPR27 = 0xFFFFFFFF;
IOMUXC_GPR_GPR28 = 0xFFFFFFFF;
IOMUXC_GPR_GPR29 = 0xFFFFFFFF;
Now if some/all of these pins are switched back to these modes, then there are more interrupt vectors that can bet setup and used:
Code:
IRQ_GPIO1_INT0 = 72,
IRQ_GPIO1_INT1 = 73,
IRQ_GPIO1_INT2 = 74,
IRQ_GPIO1_INT3 = 75,
IRQ_GPIO1_INT4 = 76,
IRQ_GPIO1_INT5 = 77,
IRQ_GPIO1_INT6 = 78,
IRQ_GPIO1_INT7 = 79,
IRQ_GPIO1_0_15 = 80,
IRQ_GPIO1_16_31 = 81,
IRQ_GPIO2_0_15 = 82,
IRQ_GPIO2_16_31 = 83,
IRQ_GPIO3_0_15 = 84,
IRQ_GPIO3_16_31 = 85,
IRQ_GPIO4_0_15 = 86,
IRQ_GPIO4_16_31 = 87,
IRQ_GPIO5_0_15 = 88,
IRQ_GPIO5_16_31 = 89,
But all of the core code is setup for the 6-9.
I have had some luck playing with ones like: IRQ_GPIO1_0_15 = 80
but in my short time playing with them, not with the couple specific ones like: IRQ_GPIO1_INT1
Like I believe I should be able to
1 AD_B0_02 1.02 Serial1(6) TX SPI1(3) MISO PWM1_X0 2_TX IO-16
0 AD_B0_03 1.03 Serial1(6) RX SPI1(3) CS0 PWM1_X1 2_RX IO-17
Pin 0 is GPIO1 pin 3 SO maybe: IRQ_GPIO1_INT3 should work and dito for Pin 1 IRQ_GPIO1_INT2
But I probably missed setting something up for them.