Hey all,
I got an issue which I don't believe is actually related to a malfunctioning of this library, but perhaps a limitation or conflict between the UART/I2C/Interrupts on my Teensy 4.1 or perhaps just the nature of Serial comms on Arduino.
Quick setup summary:
Teensy 4.1 with 1x 23017 and 1x 8574 on the same I2C channel (Yeah, I need lots of I/O)
3x Serial Ports for Modbus communication: 2x servo drives and 1x for receiving commands from a PC.
Most of the I/O expander pins are being used for button (19x) & encoder (1x) inputs using a separate interrupt pin on the Teensy for each expander.
And then most of the remaining non-UART/I2C/SPI pins on the teensy are going to LED and SSR outputs.
In the attached image I have captured a segment of the system all working together with my logic analyzer. You can see that when the serial commands are being sent to the servo drive, the INT pin of my 23017 (where my encoder lives) doesn't get reset quickly. This causes encoder ticks to get missed by the ISR.
In this example, that's actually not a huge deal because the serial command is only going out twice a second. But in the final operation of this system, I will be sending serial commands closer to 20x/second with each of the two serial ports going to the servo drives.
In practice this makes my encoder input almost unusable. I have a very short onEncoderChange() callback which just increments a variable that I then use in my main scheduled task to calculate what commands to send to the servos, so I'm not sure what else I may be able to do to mitigate this issue.
For example: Would moving my encoder to direct interrupt-enabled inputs on the Teensy help?
I'm working on a prototype PCB which marries all this stuff together, so I don't want to go cutting traces and bodging wires until I have some guidance from someone wiser than I.
Thanks in advance and sorry for posting another long winded thread.
Any insight is always greatly appreciated.