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

Thread: Can the UARTs on the Teensy 4.1 be allocated to alternate pins?

  1. #1
    Junior Member
    Join Date
    Jun 2021
    Location
    Melbourne, Australia
    Posts
    16

    Can the UARTs on the Teensy 4.1 be allocated to alternate pins?

    The Teensy 4.1 has 8 UARTs which have default pins, e.g. RX2, TX2 go to pins 7,8.

    However, the Teensy 4.1 processor (IMXRT1062XRM) has an "IOMUX" capability which seems to allow pins' functions to be changed and re-allocated.
    I'm wading thru the processor manual trying to figure out how this works.

    Has anyone used this capability, and specifically, does anyone know if it can be used to shift the position of the UART pins?
    If so, can this be used within the Arduino framework?

    Thanks

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,375
    Yes some of the pins, do allow to you to use some other specific pins.

    The product card tries to show you the default pin and alternates:

    For example for Serial1
    The default pins for RX and TX are (0 and 1), but there are alternates on the back of 52 and 53
    You will notice on the card it shows with lighter color and gray text instead of black...

    The Hardware Serial class has methods to allow you to choose (setRX and setTX)
    So for example you can do: Serial1.setTX(53);
    And it should allow you to use those pins.
    Likewise Serial1.setRX(52);

    As you may notice there are only a few of these alternate pins.

    For RX, (and CTS), there is another set of pins that can be used. And that is any XBar pin. Note: On each UART you can only use one (or none) XBar pin for either RX or CTS
    To choose one for RX, again the Serail1.setRX(2); Will try use use pin 2 for the RX and it is in my table of XBAR pins in HardwareSerail.cpp...

    Unfortunately, there was not enough room on the Cards for Paul to fit everything, so I don't think it shows you which pins are XBAR...
    From image of my excel page... You can see the XBar pins marked in Green.
    Click image for larger version. 

Name:	Screenshot.png 
Views:	34 
Size:	554.2 KB 
ID:	29822

    That is more or less it as far as using the HardwareSerial IOMUXC stuff.

    In addition to this, there is the ability to use FlexIO pins to try to make your own types of things.
    There is a copy of my FlexIO library (https://github.com/KurtE/FlexIO_t4) now in Teensyduino, where I have some somewhat limited Serail object, that can be configured to be TX only, RX only or both. And they use the FlexIO pins that are marked in Yellow in the above image. More if you are interested and/or look at the Readme file:

  3. #3
    Junior Member
    Join Date
    Jun 2021
    Location
    Melbourne, Australia
    Posts
    16
    Thanks very much Kurt for the quick response.

    That's just the sort of thing I was looking for... I'll try that out.

    BTW that's a useful diagram.

    Best Rgds, Gary

Posting Permissions

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