0

So I was looking at alternate functions of the GPIO pins of the Raspberry Pi 3b+ and found that some GPIO pins do support txd and rxd alternate functions. However some are named txd0/rxd0 and some are named txd1/rxd1, and they appear multiple times in different GPIOs. Does anyone know what this means? Does this mean I only have 2 sets of txd/rxd pins? picture

aldo
  • 33
  • 1
  • 2
  • 7
  • This is called pin multiplexing (pinmux) , and generally a given peripheral can be connected to several different pins at the designers discretion for routing convenience, however only one set of pins can be used at one time for a given peripheral . Other MCUs can have much larger pin mux tables, some do not support multiplexing at all. – crasic Oct 07 '19 at 20:05
  • Might be of interest: https://raspberrypi.stackexchange.com/q/3469/19949 – Ghanima Oct 07 '19 at 21:23
  • @aldo, Ah, let me see, my answer to the following question shows how to DIY 20 USB to TTL UART serial ports on Rpi3B+: https://raspberrypi.stackexchange.com/questions/98393/options-to-add-20-uart-to-rpi – tlfong01 Oct 08 '19 at 01:55

2 Answers2

2

The Pi has many hardware peripherals. The first of each type is labelled with a 0, if there are more than one of that type of hardware peripheral subsequent ones are named 1, 2, etc.

The hardware peripherals may be multiplexed onto more than one group of GPIO.

In your case you see TX 0 and TX 1 which indicates there are two hardware UARTs.

UART 0 may be multiplexed to GPIO 14/15 and GPIO 32/33.

UART 1 may also be multiplexed to GPIO 14/15 and GPIO 32/33.

joan
  • 71,024
  • 5
  • 73
  • 106
  • So say if I want to use UART 0, then I can set the TXD at GPIO 14, and for the RXD I can choose between GPIO 15 or GPIO 33? – aldo Oct 07 '19 at 20:35
  • @aldo You could. Mind you GPIO 33 is only available on the compute module. The Pis with the 40 pin expansion header only give access to GPIO 0-27. – joan Oct 07 '19 at 21:36
0

The Answer by Joan is correct. But to clarify you can only use ONE serial interface on the GPIO.

On all models with on-board WiFi the primary serial interface is connected to Bluetooth. The secondary interface has a few limitations (although for most uses these are not an issue). See How do I make serial work on the Raspberry Pi3 , Pi3B+, PiZeroW

Milliways
  • 59,890
  • 31
  • 101
  • 209