Difference between revisions of "Serial port"
(→Serial Device Names under Multiple Platforms) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
[[Serial port/zh|查看中文]] | [[Serial port/zh|查看中文]] | ||
− | ====Serial Device Names under Multiple Platforms | + | ===Serial port communication in C=== |
− | + | Please refre:[https://github.com/friendlyarm/comtest] | |
+ | |||
+ | ===Serial Device Names under Multiple Platforms=== | ||
+ | ====Allwinner H3/H5 Based Boards (NanoPi M1/NanoPi M1 Plus etc)==== | ||
UART1-> /dev/ttyS1<br /> | UART1-> /dev/ttyS1<br /> | ||
UART2 -> /dev/ttyS2<br /> | UART2 -> /dev/ttyS2<br /> | ||
UART3 -> /dev/ttyS3 (Only applies to NanoPi M1, NanoPi K1 and NanoPi K1 Plus)<br /> | UART3 -> /dev/ttyS3 (Only applies to NanoPi M1, NanoPi K1 and NanoPi K1 Plus)<br /> | ||
− | + | ====S5P4418 Based Boards (NanoPi Fire2A/NanoPi M2A/NanoPi S2/NanoPC-T2 etc)==== | |
UART1 -> /dev/ttyAMA1 [Note 1]<br /> | UART1 -> /dev/ttyAMA1 [Note 1]<br /> | ||
UART2 -> /dev/ttyAMA2 [Note 1]<br /> | UART2 -> /dev/ttyAMA2 [Note 1]<br /> | ||
Line 13: | Line 16: | ||
UART4 -> /dev/ttyAMA4<br /> | UART4 -> /dev/ttyAMA4<br /> | ||
− | + | ====S5P6818 Based Boards (NanoPi M3/NanoPC-T3 etc)==== | |
UART1 -> /dev/ttySAC1 [Note 1]<br /> | UART1 -> /dev/ttySAC1 [Note 1]<br /> | ||
UART2 -> /dev/ttySAC2 [Note 1]<br /> | UART2 -> /dev/ttySAC2 [Note 1]<br /> | ||
Line 20: | Line 23: | ||
<br /> | <br /> | ||
Note 1: only applies to specific boards, you need to check if a board has that serial device populated. | Note 1: only applies to specific boards, you need to check if a board has that serial device populated. | ||
+ | ====NanoPC T4==== | ||
+ | UART4 Only | ||
+ | ::{| class="wikitable" | ||
+ | |- | ||
+ | |Serial Port || Funcation | ||
+ | |- | ||
+ | |UART0 || Bluetooth | ||
+ | |- | ||
+ | |UART1 || Ehternet | ||
+ | |- | ||
+ | |UART2 || Debug UART | ||
+ | |- | ||
+ | |UART3 || Ehternet | ||
+ | |- | ||
+ | |UART4 || Available, /dev/ttyS4 | ||
+ | |} | ||
+ | |||
+ | ===Uart Test Demo === | ||
+ | * General test method | ||
+ | The serial device test method described below is a general test method, which is applicable to the Allwinner H3/H5 platform development board, the S5P4418 platform development board, and the S5P6818 platform development board. | ||
+ | |||
+ | step1)Get test demo:<br> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | $ git clone https://github.com/friendlyarm/comtest.git | ||
+ | $ cd comtest | ||
+ | $ gcc -o comtest comtest.c | ||
+ | </syntaxhighlight> | ||
+ | step2)Usage.<br> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | $ ./comtest -d /dev/ttyS2 -s 115200 | ||
+ | </syntaxhighlight> | ||
+ | After that, the data can be received through the ttyS2. <br> | ||
+ | Press the Esc key 3 times to exit the program. <br> |
Latest revision as of 06:02, 14 February 2019
Contents
1 Serial port communication in C
Please refre:[1]
2 Serial Device Names under Multiple Platforms
2.1 Allwinner H3/H5 Based Boards (NanoPi M1/NanoPi M1 Plus etc)
UART1-> /dev/ttyS1
UART2 -> /dev/ttyS2
UART3 -> /dev/ttyS3 (Only applies to NanoPi M1, NanoPi K1 and NanoPi K1 Plus)
2.2 S5P4418 Based Boards (NanoPi Fire2A/NanoPi M2A/NanoPi S2/NanoPC-T2 etc)
UART1 -> /dev/ttyAMA1 [Note 1]
UART2 -> /dev/ttyAMA2 [Note 1]
UART3 -> /dev/ttyAMA3
UART4 -> /dev/ttyAMA4
2.3 S5P6818 Based Boards (NanoPi M3/NanoPC-T3 etc)
UART1 -> /dev/ttySAC1 [Note 1]
UART2 -> /dev/ttySAC2 [Note 1]
UART3 -> /dev/ttySAC3
UART4 -> /dev/ttySAC4
Note 1: only applies to specific boards, you need to check if a board has that serial device populated.
2.4 NanoPC T4
UART4 Only
Serial Port Funcation UART0 Bluetooth UART1 Ehternet UART2 Debug UART UART3 Ehternet UART4 Available, /dev/ttyS4
3 Uart Test Demo
- General test method
The serial device test method described below is a general test method, which is applicable to the Allwinner H3/H5 platform development board, the S5P4418 platform development board, and the S5P6818 platform development board.
step1)Get test demo:
$ git clone https://github.com/friendlyarm/comtest.git $ cd comtest $ gcc -o comtest comtest.c
step2)Usage.
$ ./comtest -d /dev/ttyS2 -s 115200
After that, the data can be received through the ttyS2.
Press the Esc key 3 times to exit the program.