Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: teensy 4 pinout names?

  1. #1
    Junior Member
    Join Date
    Apr 2020
    Posts
    2

    teensy 4 pinout names?

    Looking to get a keyboard firmware up using teensy 4, running into an issue finding the A-F/1-7 canonical pinout names (i.e. what was common for teensy 2.0). For the life of me i can't find the GPIO port names anywhere. Thanks in advance

    K

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,106
    Look for those names on the schematic.

    https://www.pjrc.com/teensy/schematic.html

    NXP uses more complex names than simple 1 letter and a number. They are names like "AD_B1_09" or "EMC_07".

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    935
    For the life of me i can't find the GPIO port names anywhere.
    I'm not sure, but if you are just looking for the relation of GPIO port/bit and the Teensy pin numbers you can print them out with the code described here: https://github.com/TeensyUser/doc/wi...w-level-access
    This is what it prints out for a T4.


    Code:
    PIN   GPIOn-BITm  |  GPIOn-BITm    PIN
    ------------------|-------------------
    00  -> GPIO6-03   |   GIPO6-02  ->  01
    01  -> GPIO6-02   |   GIPO6-03  ->  00
    02  -> GPIO9-04   |   GIPO6-12  ->  24
    03  -> GPIO9-05   |   GIPO6-13  ->  25
    04  -> GPIO9-06   |   GIPO6-16  ->  19
    05  -> GPIO9-08   |   GIPO6-17  ->  18
    06  -> GPIO7-10   |   GIPO6-18  ->  14
    07  -> GPIO7-17   |   GIPO6-19  ->  15
    08  -> GPIO7-16   |   GIPO6-22  ->  17
    09  -> GPIO7-11   |   GIPO6-23  ->  16
    10  -> GPIO7-00   |   GIPO6-24  ->  22
    11  -> GPIO7-02   |   GIPO6-25  ->  23
    12  -> GPIO7-01   |   GIPO6-26  ->  20
    13  -> GPIO7-03   |   GIPO6-27  ->  21
    14  -> GPIO6-18   |   GIPO6-30  ->  26
    15  -> GPIO6-19   |   GIPO6-31  ->  27
    16  -> GPIO6-23   |   GIPO7-00  ->  10
    17  -> GPIO6-22   |   GIPO7-01  ->  12
    18  -> GPIO6-17   |   GIPO7-02  ->  11
    19  -> GPIO6-16   |   GIPO7-03  ->  13
    20  -> GPIO6-26   |   GIPO7-10  ->  06
    21  -> GPIO6-27   |   GIPO7-11  ->  09
    22  -> GPIO6-24   |   GIPO7-12  ->  32
    23  -> GPIO6-25   |   GIPO7-16  ->  08
    24  -> GPIO6-12   |   GIPO7-17  ->  07
    25  -> GPIO6-13   |   GIPO8-12  ->  37
    26  -> GPIO6-30   |   GIPO8-13  ->  36
    27  -> GPIO6-31   |   GIPO8-14  ->  35
    28  -> GPIO8-18   |   GIPO8-15  ->  34
    29  -> GPIO9-31   |   GIPO8-16  ->  39
    30  -> GPIO8-23   |   GIPO8-17  ->  38
    31  -> GPIO8-22   |   GIPO8-18  ->  28
    32  -> GPIO7-12   |   GIPO8-22  ->  31
    33  -> GPIO9-07   |   GIPO8-23  ->  30
    34  -> GPIO8-15   |   GIPO9-04  ->  02
    35  -> GPIO8-14   |   GIPO9-05  ->  03
    36  -> GPIO8-13   |   GIPO9-06  ->  04
    37  -> GPIO8-12   |   GIPO9-07  ->  33
    38  -> GPIO8-17   |   GIPO9-08  ->  05
    39  -> GPIO8-16   |   GIPO9-31  ->  29

  4. #4
    Junior Member
    Join Date
    Apr 2020
    Posts
    2
    Thank you for the reply, this is helpful. However the issue I suppose lies in the firmware building tool I hope to use, which only allows for A0,A1... F0,F1 style pin addressing. Previously the teensy had corresponding pin labelling, as here : https://www.pjrc.com/teensy/pinout2a.png

    essentially i'm looking for the mapping for T4 similar to what is shown here -

    https://forum.pjrc.com/threads/17532...ll=1#post21228

    Quote Originally Posted by luni View Post
    I'm not sure, but if you are just looking for the relation of GPIO port/bit and the Teensy pin numbers you can print them out with the code described here: https://github.com/TeensyUser/doc/wi...w-level-access
    This is what it prints out for a T4.


    Code:
    PIN   GPIOn-BITm  |  GPIOn-BITm    PIN
    ------------------|-------------------
    00  -> GPIO6-03   |   GIPO6-02  ->  01
    01  -> GPIO6-02   |   GIPO6-03  ->  00
    02  -> GPIO9-04   |   GIPO6-12  ->  24
    03  -> GPIO9-05   |   GIPO6-13  ->  25
    04  -> GPIO9-06   |   GIPO6-16  ->  19
    05  -> GPIO9-08   |   GIPO6-17  ->  18
    06  -> GPIO7-10   |   GIPO6-18  ->  14
    07  -> GPIO7-17   |   GIPO6-19  ->  15
    08  -> GPIO7-16   |   GIPO6-22  ->  17
    09  -> GPIO7-11   |   GIPO6-23  ->  16
    10  -> GPIO7-00   |   GIPO6-24  ->  22
    11  -> GPIO7-02   |   GIPO6-25  ->  23
    12  -> GPIO7-01   |   GIPO6-26  ->  20
    13  -> GPIO7-03   |   GIPO6-27  ->  21
    14  -> GPIO6-18   |   GIPO6-30  ->  26
    15  -> GPIO6-19   |   GIPO6-31  ->  27
    16  -> GPIO6-23   |   GIPO7-00  ->  10
    17  -> GPIO6-22   |   GIPO7-01  ->  12
    18  -> GPIO6-17   |   GIPO7-02  ->  11
    19  -> GPIO6-16   |   GIPO7-03  ->  13
    20  -> GPIO6-26   |   GIPO7-10  ->  06
    21  -> GPIO6-27   |   GIPO7-11  ->  09
    22  -> GPIO6-24   |   GIPO7-12  ->  32
    23  -> GPIO6-25   |   GIPO7-16  ->  08
    24  -> GPIO6-12   |   GIPO7-17  ->  07
    25  -> GPIO6-13   |   GIPO8-12  ->  37
    26  -> GPIO6-30   |   GIPO8-13  ->  36
    27  -> GPIO6-31   |   GIPO8-14  ->  35
    28  -> GPIO8-18   |   GIPO8-15  ->  34
    29  -> GPIO9-31   |   GIPO8-16  ->  39
    30  -> GPIO8-23   |   GIPO8-17  ->  38
    31  -> GPIO8-22   |   GIPO8-18  ->  28
    32  -> GPIO7-12   |   GIPO8-22  ->  31
    33  -> GPIO9-07   |   GIPO8-23  ->  30
    34  -> GPIO8-15   |   GIPO9-04  ->  02
    35  -> GPIO8-14   |   GIPO9-05  ->  03
    36  -> GPIO8-13   |   GIPO9-06  ->  04
    37  -> GPIO8-12   |   GIPO9-07  ->  33
    38  -> GPIO8-17   |   GIPO9-08  ->  05
    39  -> GPIO8-16   |   GIPO9-31  ->  29

  5. #5
    Senior Member
    Join Date
    Feb 2015
    Location
    Finland
    Posts
    189
    Teensy 4 is not an 8-bit AVR, it is a 32-bit ARM. Are you sure your firmware building tool will work for Teensy 4?

    Teensy 4 does not have 8-bit ports (PORT A..F bit 0..7), it has 32-bit GPIO ports. The table luni posted is the mapping (if one corrects GIPO to GPIO). The pins on Teensy 4 use GPIO banks 6, 7, 8, and 9. Each bank has 32 bits. So, for example,
    Code:
    15 -> GPIO6-19 | GPIO6-19 -> 15
    means that Teensy 4 pin 15, is bit 19 in GPIO bank 6. (The only thing that is missing is that the manual calls it pin AD_B1_03; and these are shown in the schematic.)

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,927
    You might look at the file arv\cores\teensy4\avr_emulation.h and see if it has what you need/want...

    It looks like it has some quick and dirty defines for some of the things like PORTD, PIND, ... From this you should be able to map out which pin does what...
    Like it looks like PORTD is mapped to pins 0-7...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •