树莓派在没有显示使用时,可以使用usb串口转ttl进行连接。
USB转ttl线 CP2102下载对应的驱动
USB转TTL 驱动下载地址:http://pan.baidu.com/s/1mgCFd9m
安装完成后重启系统,插入 USB to TTL 线可查询串口设备。
1 2
$ ls /dev/tty.usbserial* #在Mac是这个,去查看。插拔usb能够看到对应的设备 /dev/tty.usbserial
USB转TTL线
树莓派3b+引脚图
USB to TTL 线与树莓派针脚对应关系为:
GND -> GND
RXD -> GPIO 14(TXD)
TXD -> GPIO 15(RXD)
VCC -> 悬空 (切记, 不要乱接)
注意: 一定按照上面的对应关系,不要接成一样的。
配置minicom参数
运行
1
sudo minicom -s
进入minicom界面
1 2 3 4 5 6 7 8 9 10 11 12
┌─────[configuration]──────┐ │ Filenames and paths │ │ File transfer protocols │ │ Serial port setup │ │ Modem and dialing │ │ Screen and keyboard │ │ Save setup as dfl │ │ Save setup as.. │ │ Exit │ │ Exit from Minicom │ └──────────────────────────┘
使用上下键选择Serial port setup,回车。此时停留在change which setting? 通过A,B,C,D选项设置对应的参数设置例如下
1 2 3 4 5 6 7 8 9 10 11 12
┌───────────────────────────────────────────────────────────────────────┐ │ A - Serial Device : /dev/modem │ │ B - Lockfile Location : /usr/local/Cellar/minicom/2.7.1/var │ │ C - Callin Program : │ │ D - Callout Program : │ │ E - Bps/Par/Bits : 115200 8N1 │ │ F - Hardware Flow Control : Yes │ │ G - Software Flow Control : No │ │ │ │ Change which setting? │ └───────────────────────────────────────────────────────────────────────┘
配置选项目录
选择"Filenames and paths"
1 2 3 4 5 6 7 8 9 10 11
┌───────────────────────────────────────────────────────────────────────┐ │ A - Download directory : /home/wonux │ │ B - Upload directory : /tmp │ │ C - Script directory : /root/minicom │ │ D - Script program : runscript or /bin/bash │ │ E - Kermit program : │ │ F - Logging options │ │ │ │ Change which setting? │ └───────────────────────────────────────────────────────────────────────┘
常用配置总结:
选择Serial port setup
配置选项如下:
1 2 3 4
A - Serial Device : /dev/modem E - Bps/Par/Bits : 115200 8N1 F - Hardware Flow Control : No G - Software Flow Control : No
选择Filenames and paths
配置其中的如下配置项:
1 2
C - Script directory : /root/minicom D - Script program : /bin/bash