brtaylor
Well-known member
I have a Teensy 4.1 project that has two external interrupts:
After reading threads about how all GPIO pins are on IRQ_GPIO6789 since they are configured for fast I/O, it was suggested that one of the pins could be configured for slow I/O and put on a different IRQ.
I'm writing out the path I'm following, partly as notes for myself, but I welcome feedback on the approach and whether I'm headed in the right direction.
In startup.c, it looks like fast I/O is set here:
github.com
From Section 3.2.2 of this application note (https://www.nxp.com/docs/en/application-note/AN12240.pdf), looks like I set a bit to zero to set it for slow I/O.
I've been trying to figure out how this ties together. If I follow GPIO6_DR, that's used in core_pins.h to set the pin port registers, i.e.:
github.com
That definition comes from imxrt.h:
So, it looks to me like that I could modify the bits in startup.c to configure a pin for slow I/O and then use GPIO1_DR instead of GPIO6_DR in the port register.
- One interrupt is tied to the data ready pin from a sensor. When this fires, I read the sensor data, perform some processing on the data, and add it to a circular buffer. The sensor is configured to fire this interrupt at 200 Hz. In the lower priority loop, this buffer is read and dumped to an SD card in 512 byte chunks.
- One interrupt is tied to GPS timepulse, which is configured to fire at 10 Hz. I use this to reset an elapsedMicros timer and, along with the GPS data, I can timestamp my 200 Hz data frames relative to the GPS time of week with microsecond resolution. Within this interrupt, I also compare the elapsedMicros to the expected duration to compute a scale factor to correct the elapsedMicros result.
After reading threads about how all GPIO pins are on IRQ_GPIO6789 since they are configured for fast I/O, it was suggested that one of the pins could be configured for slow I/O and put on a different IRQ.
I'm writing out the path I'm following, partly as notes for myself, but I welcome feedback on the approach and whether I'm headed in the right direction.
In startup.c, it looks like fast I/O is set here:
cores/teensy4/startup.c at 601e8014b32621cbf03f3d52c98a674648d1fce0 · PaulStoffregen/cores
Teensy Core Libraries for Arduino. Contribute to PaulStoffregen/cores development by creating an account on GitHub.
From Section 3.2.2 of this application note (https://www.nxp.com/docs/en/application-note/AN12240.pdf), looks like I set a bit to zero to set it for slow I/O.
I've been trying to figure out how this ties together. If I follow GPIO6_DR, that's used in core_pins.h to set the pin port registers, i.e.:
cores/teensy4/core_pins.h at 601e8014b32621cbf03f3d52c98a674648d1fce0 · PaulStoffregen/cores
Teensy Core Libraries for Arduino. Contribute to PaulStoffregen/cores development by creating an account on GitHub.
That definition comes from imxrt.h:
So, it looks to me like that I could modify the bits in startup.c to configure a pin for slow I/O and then use GPIO1_DR instead of GPIO6_DR in the port register.