knute
Posts: 473
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

UART on Pi3B & 3B+ ?

Wed Jan 16, 2019 3:53 am

I've got a project coming that needs to communicate via serial and I have no experience with Pis and the serial port. Fortunately it is 3.3v and won't require any level conversion. My first question is about baud rates and buffers. Can the Pi receive data at 115200 baud and clear the buffer fast enough to prevent overruns? The second is, is there any hardware flow control available (RTS,CTS)?

Thanks!

Idahowalker
Posts: 445
Joined: Wed Jan 03, 2018 5:43 pm

Re: UART on Pi3B & 3B+ ?

Wed Jan 16, 2019 4:17 am

I ran a RPi to Arduino Due serial communication at 230400 without issues. I did not use any hardware flow control. I used software flow control. I used "<" to start a message and ">" to end a message sentence for each direction. I'd ignore bytes till the data stream hit a ">" and keep collecting data till a ">" was reached. I'd then send the data to a thread for further processing and continue to read the data stream. it did not take long for a sync and when synced, I'd not have data loss issues. I had wrote code to check for data sentence errors but found it was not needed.

I did have a Arduino Mega where I used a trigger pin to let the RPi know data was available but found it was not necessary with using "<" and ">" as sentence delimiters.
Without knowing why you are deleting my postings, I will not know how...

klricks
Posts: 6592
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: UART on Pi3B & 3B+ ?

Wed Jan 16, 2019 4:24 am

knute wrote:
Wed Jan 16, 2019 3:53 am
.....The second is, is there any hardware flow control available (RTS,CTS)?
If UART 1 is used then RTS and CTS is available.

(UART 0 has no flow control)
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

knute
Posts: 473
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: UART on Pi3B & 3B+ ?

Thu Jan 17, 2019 4:02 am

Idahowalker wrote:
Wed Jan 16, 2019 4:17 am
I ran a RPi to Arduino Due serial communication at 230400 without issues. I did not use any hardware flow control. I used software flow control. I used "<" to start a message and ">" to end a message sentence for each direction. I'd ignore bytes till the data stream hit a ">" and keep collecting data till a ">" was reached. I'd then send the data to a thread for further processing and continue to read the data stream. it did not take long for a sync and when synced, I'd not have data loss issues. I had wrote code to check for data sentence errors but found it was not needed.

I did have a Arduino Mega where I used a trigger pin to let the RPi know data was available but found it was not necessary with using "<" and ">" as sentence delimiters.
Thanks for that!

knute
Posts: 473
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: UART on Pi3B & 3B+ ?

Thu Jan 17, 2019 4:04 am

klricks wrote:
Wed Jan 16, 2019 4:24 am
knute wrote:
Wed Jan 16, 2019 3:53 am
.....The second is, is there any hardware flow control available (RTS,CTS)?
If UART 1 is used then RTS and CTS is available.

(UART 0 has no flow control)
Is there documentation somewhere on which pins for RTS/CTS and on the port in general?

Thanks.

klricks
Posts: 6592
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: UART on Pi3B & 3B+ ?

Thu Jan 17, 2019 5:01 am

knute wrote:
Thu Jan 17, 2019 4:04 am
klricks wrote:
Wed Jan 16, 2019 4:24 am
knute wrote:
Wed Jan 16, 2019 3:53 am
.....The second is, is there any hardware flow control available (RTS,CTS)?
If UART 1 is used then RTS and CTS is available.

(UART 0 has no flow control)
Is there documentation somewhere on which pins for RTS/CTS and on the port in general?

Thanks.
I may have been mistaken there appears to be RTS & CTS on both UARTs
Note that you can only use 1 UART at a time as they both share the same physical pins.
https://pinout.xyz/pinout/pin36_gpio16#
Click on BCM 16 & 17

I don't know how to enable the ALT functions?
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Return to “Beginners”