Firstly, I am rather new to RPI and very new to the device tree / overlays, so please bare with me!

I have a WaveShare display (https://www.waveshare.com/wiki/3.5inch_HDMI_LCD) which occupies physical pins 1-26 of the GPIO connector, even though it hardly uses any of them. I am not even using the touch part, just the power and HDMI input.

I would like to remap the PL011 UART to the connector, and specifically to GPIO pins that are not occupied by the display connector (say GPIO20 and GPIO21).

I think I can use the overlay at #2 and include the following line in /boot/config.txt

Unfortunately your scheme won't work. There is only one set of pins brought out onto the 40-pin header that can carry the UART signals - GPIOs 14-17 (TXD, RXD, CTS & RTS). These signals can be from UART0 (ttyAMA0) or UART1 (ttyS0), but not both. You need to read page 102 of the BCM2835 ARM Peripherals guide, where you will find details of the possible permutations.

PhilE wrote:
Unfortunately your scheme won't work. There is only one set of pins brought out onto the 40-pin header that can carry the UART signals - GPIOs 14-17 (TXD, RXD, CTS & RTS). These signals can be from UART0 (ttyAMA0) or UART1 (ttyS0), but not both. You need to read page 102 of the BCM2835 ARM Peripherals guide, where you will find details of the possible permutations.

Thank you for the fast reply!

Ah, if I understand correctly then... it is only possible to remap pins within the confines of the allowable alternative functions for each pin.

So, in this context the capability provided by the overlay is the same at boot time as something like:

I used your code for my CM3 Lite. I connected the CM3 to my laptop using a USB to TTL converter. I use screen to view if my CM3 is booting or not. Well it is booting and your code works. However, I am not able to send any input from my keyboard to the CM3. So this means, Tx is working but Rx is not working. I tried with both alt2 an alt3, but the same result. Tx works, Rx doesn't work.

Last edited by Sohil.Mehta on Tue Apr 17, 2018 10:37 am, edited 2 times in total.

Are the flow control settings correct on both ends? If the terminal emulator on your laptop has RTS/CTS enabled then it may be waiting for a Clear-To-Send signal. Try sending characters to another target if you have one.

Update: When I use Alt2 or Alt3, I get data even on pin 14 (Tx). But pin 15 (Rx) doesn't work. How can this be possible? It should work only on 36 or 32 right for Alt2 and Alt3 respectively. Also, only when I use the default Alt0 pins 14 and 15, both Rx and Tx work i.e I am able to receive data from CM3 and I am able to send data to the CM3 from my laptop

Are the flow control settings correct on both ends? If the terminal emulator on your laptop has RTS/CTS enabled then it may be waiting for a Clear-To-Send signal. Try sending characters to another target if you have one.

If that's the case, it should not work for Alt0 right? But Rx and Tx works perfectly well on 15 and 14.

Anyway, I will try what you told me to do. Are you trying to say I use some other terminal on my Linux machine instead of screen and check what's happening?

It sounds like you have the same function mapped to mutiple pins, which is usually bad.

Install raspi-gpio if you don't already have it (sudo apt-get install raspi-gpio), or use your favourite GPIO utility, and record the state of all GPIOs. Then, if TXD0 and RXD0 appears in multiple places, use the utility to return the other pins to inputs. In raspi-gpio that would be (assuming 14 and 15 are still on alt0):

Yes you are absolutely right PhilE. I made a mistake. Please ignore. I deleted my comment too.

So I did exactly what you said in the above comment. I set 14 and 15 to ip. Also, I removed the line enable_uart=1 and have retained dtoverlay=uart0,...........,pin_func=6 in config.txt Now, after I reboot, the changes are lost and 14 and 15 are set as TXD0 and RXD0 again. Also, they are conflicting with 36 and 37. This means I need to permanently disable UART0 on 14 and 15. How to do this? Include raspi-gpio set 14 ip and raspi-gpio set 15 ip in /etc/rc.local ?

I want to connect HDMI display 5" (26 header pins) to R-Pi3. Also want to use UART0 (Tx= GPIO14, Rx=GPIO15).
So remapped UART 0 to Tx= GPIO36 and RX = GPIO=37 by using the command in config.txt file :

dtoverlay=uart0 ,txd0_pin36,rxdo_pin=37,pin_func=7 # alt 3

Also included following command in rc.local :

raspi-gpio set 14 ip
raspi-gpio set 15 ip

On entering "raspi-gpio get command" , i am getting TXD0 and RXD0 enabled at GPIO 14, GPIO 15 and GPIO36 ,GPIO37 respectively ,but still serial communication is not working, Though it was working on GPIO14, GPIO15 .

Having had a chance to try myself, I can see that the problem is your alt function for 36 and 37. Alt3 (7) for 36 and 37 is SD1_DAT0&1 - you want Alt2 (6), which works once you set 14 and 15 to inputs. I hope to have an answer to the lack of unmapping of 14 and 15 soon.