Does T4.0 have PORTS - like read 8 pins at once?

Not open for further replies.


Well-known member
Sorry if this is a tad basic - I've been away for about a year and have gotten a bit rusty!

I want to read Bourns EAW ACE128 absolute encoder. The encoder provides 8 pins showing values which when evaluated with a map table of all the 256 possible pin combinations and how they map to the 128 gray code values. Invalid locations are filled with 255.

Is there any sort of "byte-read" or PORT with Teensy 4.0? Also I realize there are many other possible ways to do this - ideas welcome!

BTW the T4 is FAR more horsepower than needed by this project - just want to start doing SOMETHING with it.
... I won't be surprised if this has already been done but have not found anything. :)
Yes, the basic PORT architecture is the basically same in the 1062 used on T_4.0 and 4.1 and prior ARM Teensy.

Check out the T_4.0 schematic or a posted summary for pin to port mapping.

The access is on GPIO[6,7,8,9] for reading the 32 bit ports. Then masking/shifting as needed to see the bits as desired.

This thread may give needed access example :: Teensy-4-1-Storing-the-value-of-18-pins-input-quickly
> There are others, forum search for GPIO6 produced that one
Being quite new to the Teensy world - what is GPIO[6,7,8,9] referring to? Are those just pin numbers or some port combo? (been doing Arduino for number of years but just getting feet wet with Teensy)

Just pulled down the EXCELLENT color diagram of the T4.0. Could use a little clarification on the terminology.

Just re-read your post - now I see it is The yellow FlexIO have "n:n" figures. Is this another "function:pin" reference?
Last edited:
Sorry if you are talking about my Excel document, and wondering differences in some columns I used something like for Pin2:
EMC_04 4.4 O2 1:4 6 4A2 2

Each of these columns are associated with different subsystem. And differences between 4.4 and 1:4 in these two columns... The difference in the . and : is simply noise that is, I simply was putting up some information about each System/Subsystem and I was inconsistent with How I did this... (Sorry)
But in this case. If you look at section 10.7.5 in the IMXRT1060RM manual which you can and maybe should download from the PRJC website.

The GPI: 4.4 is saying it is port 4 which is actually port 9 in the code... (Was 4 when we started Beta for T4), but then there is an option to convert these IO Ports to a higher speed and when you do so they have the different GPI PORT to access them In this case 9... Maybe I should update this document, BUT the Reference Manual PDF will refer to it as on port 4.

The FlexIO 1:4 - Is saying this pin can used with FlexIO on the FlexIO 1 object - (Chapter 49)

It can also be an XBARA pin (as XBAR 6) Chapter 60

It can do PWM - That is you can do something like analogWrite(2, 128)
and start up a PWM pulse on that pin. If you want more information on this I encoded additional information: 4A2
Which for me I know that this is FlexPWM (Chapter 54) Timer 4, Sub Timer 2 and Pin A... Most of the time you probably don't care about this detail. BUT if you wish to do things like set different PWM Frequencies than changing it on one Timer/SubTimer for all pins on a Timer/Sub-Timer. So in this case 2(4A2), 3(4B2) so both pins effected...

Note the PWM may also be done by other types of timers which I have also encoded here:
Example if you look at pin 10 it says Q10. The Q for me says Quad Timer, the first 1 is it is on Quad timer 1 and the first pin on Timer 1... (Chapter 53)

Also I showed with pins are on General Purpose timers Chapter 51... With a G followed by the number... Although these are not used for PWM...

Edit: OOPS - Disregard the PWM stuff above here for T4... I have not updated that part YET, so far it just shows P... Will do sometime soon.
Yikes! Guess I'll need to do some digging. I have been LONG fascinated by the ARM concept/processors - I have had the M4 datasheet for some time and now have the IMRX "sheet" (a mere 3400+ pages!). I printed out select sections that seem most useful for "everyday" kind of stuff and have the in 3-ring binder.

Much to my surprise - it appears all the register names (like "GPIO6") from the datasheet have been defined in the TeensyDuino package! What a job Paul has done with this - wish I'd found this a couple years ago.

So it appears to use some of the "advanced" functions one just has to wade through the manual (which I did in the early Atmega328 days) and sus out what it takes to set up and use a feature. Which for GPIO is reasonably easy. If I want to dig into stuff like FlexIO and DMA - is just going over the info in the datasheet be enough to figure these functions? I will be needing PWM as the movement of the encoder is going to have a stepper motor following it.

Thanks for all the help!
You are welcome,

As for digging. In most cases unless you need something special and/or you are the type who wants to do everything yourself. You can simply just use it. Example PWM.

Also with things like FlexIO, can always search on forum and or ask. Example I have an example FlexIO library up on my github.. which has implementations for creating Serial Port and like wise SPI object... Others have done some other interesting things as well, maybe a display.

XBar can be interesting, especially when tied to other subsystems that have support for them. Like XBar pins can be used for Serial port RX pin (Or CTS pin) (At most only one of these uses of XBar pins can be used on a specific hardware Serial port.

But one of the ways I learn a lot is by searching through the core files. Example you wish to know how a timer works, or how XBar works, I simply bring up an editor window on the sources and do a Search on all of the files.
I am new to the Teensy 4.1 world, I have been able to port some code over from an Arduino pro mini project. I have a couple of TFT displays, mpu6050 ,GPS module and an I2C PCF8574 operational. Was able to sift through the hardware serial, software and disable/ enable the interrupts for the GPS feeds as an on demand. I am in process of adding an analog multiplexer so wanted to bit bang some digital ports. Hmm a little more complicated than the venerable 328. I am a little dismayed at the lack of at least a 4 bit port that could be bit manipulated as a hex nibble other than stealing some I/O from the SD port. But understand why ( kind of) Kudos to the design team for A creating a relatively low cost powerhouse device from this complicated processor and for the Software support.
Not open for further replies.