-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UART: Label UARTs, disambiguate Pi4-only, for #428 #431
Open
Gadgetoid
wants to merge
1
commit into
master
Choose a base branch
from
patch-uart-tidyup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,77 +8,91 @@ url: http://elinux.org/RPi_Serial_Connection | |
pincount: 18 | ||
pin: | ||
'8': | ||
name: TXD / Transmit | ||
name: UART0/1 TXD | ||
direction: output | ||
active: high | ||
'10': | ||
name: RXD / Receive | ||
name: UART0/1 RXD | ||
direction: input | ||
active: high | ||
'36': | ||
name: CTS / Clear to Send | ||
name: UART0/1 CTS | ||
direction: both | ||
active: high | ||
'11': | ||
name: RTS / Request to Send | ||
name: UART0/1 RTS | ||
direction: both | ||
active: high | ||
'27': | ||
name: TXD / Transmit | ||
name: UART2 TXD | ||
direction: output | ||
active: high | ||
supported: Pi4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there was a feature which was only supported on Pi2 and Pi3 (there isn't - I'm just playing devil's advocate), I guess using |
||
'28': | ||
name: RXD / Receive | ||
name: UART2 RXD | ||
direction: input | ||
active: high | ||
supported: Pi4 | ||
'3': | ||
name: CTS / Clear to Send | ||
name: UART2 CTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'5': | ||
name: RTS / Request to Send | ||
name: UART2 RTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'7': | ||
name: TXD / Transmit | ||
name: UART3 TXD | ||
direction: output | ||
active: high | ||
supported: Pi4 | ||
'29': | ||
name: RXD / Receive | ||
name: UART3 RXD | ||
direction: input | ||
active: high | ||
supported: Pi4 | ||
'31': | ||
name: CTS / Clear to Send | ||
name: UART3 CTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'26': | ||
name: RTS / Request to Send | ||
name: UART3 RTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'24': | ||
name: TXD / Transmit | ||
name: UART4 TXD | ||
direction: output | ||
active: high | ||
supported: Pi4 | ||
'21': | ||
name: RXD / Receive | ||
name: UART4 RXD | ||
direction: input | ||
active: high | ||
supported: Pi4 | ||
'19': | ||
name: CTS / Clear to Send | ||
name: UART4 CTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'23': | ||
name: RTS / Request to Send | ||
name: UART4 RTS | ||
direction: both | ||
active: high | ||
supported: Pi4 | ||
'32': | ||
name: TXD / Transmit | ||
name: UART5 TXD | ||
direction: output | ||
active: high | ||
supported: Pi4 | ||
'33': | ||
name: RXD / Receive | ||
name: UART5 RXD | ||
direction: input | ||
active: high | ||
supported: Pi4 | ||
--> | ||
# UART - Universal Asynchronous Receiver/Transmitter | ||
--- | ||
|
@@ -87,19 +101,15 @@ pin: | |
--- | ||
UART is an asynchronous serial communication protocol, meaning that it takes bytes of data and transmits the individual bits in a sequential fashion. | ||
|
||
* TXD - Transmit | ||
* RXD - Receive | ||
* CTS - Clear to send | ||
* RTS - Request to send | ||
|
||
Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, the sender and receiver agree on timing parameters in advance and special bits called 'start bits' are added to each word and used to synchronize the sending and receiving units. | ||
|
||
UART is commonly used on the Pi as a convenient way to control it over the GPIO, or access the kernel boot messages from the serial console (enabled by default). | ||
|
||
It can also be used as a way to interface an Arduino, bootloaded ATmega, ESP8266, etc with your Pi. Be careful with logic-levels between the devices though, for example the Pi is 3.3v and the Arduino is 5v. Connect the two and you might conjure up some magic blue smoke. | ||
|
||
Raspberry Pi 2/3 have two UARTs, uart1 and uart0. Raspberry Pi 4 has four additional UARTs available. Only uart0/1 is enabled over GPIO pin 14/15 by default. The additional UARTs can be enabled through the device tree overlays. | ||
|
||
Assuming you have WiringPi-Python installed, the following python example opens the Pi's UART at 9600baud and puts 'hello world' | ||
|
||
```python | ||
import wiringpi | ||
wiringpi.wiringPiSetup() | ||
serial = wiringpi.serialOpen('/dev/ttyAMA0',9600) | ||
wiringpi.serialPuts(serial,'hello world!') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also CTS5 on Pi4 only, just to confuse things further! 🤣
(but AFAIK most people don't use CTS and RTS, so this can probably be safely ignored?)