Teensy 4.x Pins Overview for fast read/write

Richardson

Active member
I've added as txt file the Pin Overview of the Fast Ports and Bits for the Teensy 4.x and some read write and direction lines so that you do not have to search for everything in the forum.

This gives you a quick overview of how it is possible to read or write numerous pins in parallel as quickly as possible (for data ports, for example).


pic.jpg
 

Attachments

  • Teensy 4 Pins.txt
    1.3 KB · Views: 64
Bad Teensy 4 Pins dot txt.pngYou should really say what program should be used to display the .txt file when you attempt to align columns in a text file. As you can see the columns do NOT line up when viewed with notepad in Windows.
The only program I can find to display it correctly is Word and viewing in Landscape.
What editor did you use to produce this file.
Perhaps a spreadsheet may have been better where alignment can be guaranteed.
All that having bee said the information is very useful.
 

Attachments

  • bad Teensy 4 pins.txt
    41.8 KB · Views: 40
You can see it in the picture... then you can move the GPIO lines in the right direction, in every program.

Or you can use a monospaced font, or you can copy it into the Arduino IDE.
 
If you look at it properly it's NOT just the top line, that would be easy.
Look at GPIO7 does 32 belong under 19 or 20? pin 9 under 18 or 19 etc?
 
Good excel table. About "Max Contiguous bits" ... its not so relevant, because the left and right shifts are damn fast. The whole read write process is very very fast also with a lot left and right shifts also with some direction changes (with 816 Mhz).
 
Thanks very much to Richardson and BriComp both for this info, and its alternate presentation.

The example needs a slight edit though, should GPIO6 access to pins other than 0, 1, 24, or 25 be
desired. Viz., GPIO6_GDIR is 32 bits, and so...

-----------------------------------------------

The "Set Direction" lines in the example:

GPIO6_GDIR &= ~0xFFFF; // set pins to inputs
GPIO6_GDIR |= 0xFFFF; // set pins to outputs

should instead be:

GPIO6_GDIR &= ~0xFFFFFFFF; // set pins to inputs
GPIO6_GDIR |= 0xFFFFFFFF; // set pins to outputs

-----------------------------------------------

Alternatively, the Arduino pinMode(...) method could be called individually for the pins at issue.
 
Back
Top