How to use uart1 (RXD1,TXD1)


7 posts
by code0610 » Thu Jul 21, 2016 8:56 am
Hi Guys,

I need two UARTs on my raspberry pi compute module.
UART0 (RXD0,TXD0) is used for a terminal connection.
UART1 (RXD1,TXD1) should be used for communication with a device.

So i changed the GPIO Pin 32,33 to RXD1,TXD1 in my dt-blob.bin.
Now i need help how to use it in C++.
There is no new serial device in /dev/.
I read something about a driver i have to compile with the kernel sources.
But the driver i´ve found seems to be not stable or official from raspberrypi.org.
Is there no easy way to use RXD1,TXD1? Why can i configure these pins, when i can´t use it in a easy way?

regards
Sebastian
Posts: 3
Joined: Thu Jul 21, 2016 8:03 am
by PigeonComputers » Thu Jul 21, 2016 5:53 pm
Add to /boot/config.txt
Code: Select all
dtparam=uart1=on
www.pigeoncomputers.com - The Pigeon is a rugged automation controller that runs Linux on a Raspberry Pi Compute Module and offers optoisolated inputs, RS-232, RS-485, CAN, 1-wire, and more.
User avatar
Posts: 6
Joined: Fri Apr 29, 2016 7:05 am
by code0610 » Mon Jul 25, 2016 11:52 am
Hi PigeonComputers,

thanks for your reply.
I added dtparam=uart1=on to the config.txt.
But there is still no new device in /dev/.
Posts: 3
Joined: Thu Jul 21, 2016 8:03 am
by huffmania » Mon Aug 01, 2016 8:32 pm
I think you want to add this line to your /boot/config.txt (in place of the previous suggestion):
Code: Select all
dtoverlay=uart1,txd1_pin=32,rxd1_pin=33


After rebooting, /dev/ttyS0 should be available.

You may also want to check out this link which has documentation for various overlays:
https://github.com/raspberrypi/linux/tree/rpi-4.1.y/arch/arm/boot/dts/overlays. Search for uart1 -- options are documented near the bottom of the page.
Posts: 4
Joined: Mon Aug 01, 2016 8:11 pm
by code0610 » Fri Aug 05, 2016 9:49 am
It works!! Thank you very much for this hint.

regards
Sebastian
Posts: 3
Joined: Thu Jul 21, 2016 8:03 am
by oscargomezf » Mon Dec 19, 2016 10:19 am
Hi everyone,

I need two UARTs at the same time too, but I'm working on the raspberry Pi 3B instead of a compute module.
Do you know if I can try the same on a Raspberry Pi 3?

Best regards.
Posts: 19
Joined: Thu Mar 10, 2016 3:46 pm
by joan » Mon Dec 19, 2016 11:54 am
oscargomezf wrote:Hi everyone,

I need two UARTs at the same time too, but I'm working on the raspberry Pi 3B instead of a compute module.
Do you know if I can try the same on a Raspberry Pi 3?

Best regards.

Yes, you can try the same.

No, it will not work. The GPIO you need are not accessible on the Pi 3.
User avatar
Posts: 12545
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK