此博客不在更新,我的博客新地址:www.liuquanhao.com
---------------------------------------------------------------------
一:樹莓派GIPO口,需要GPIO14(TXD),GPIO15(RXD),Ground。

二:連接方式。
cp2102的rxd連接到樹莓派的txd,cp2102的txd連接到樹莓派的rxd,以及cp2102的GND連接到
樹莓派的ground。


物理鏈接收將cp2102插入pc上,樹莓派上電。
三:使用minicom連接樹莓派。
先調整參數:
liuxuzzz@liuxuzzz:~$ sudo minicom -s
+-----[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,串口初始化。
+-----------------------------------------------------------------------+
| A - Serial Device : /dev/ttyUSB0 |
| B - Lockfile Location : /var/lock |
| C - Callin Program : |
| D - Callout Program : |
| E - Bps/Par/Bits : 115200 8N1 |
| F - Hardware Flow Control : No |
| G - Software Flow Control : No |
| |
| Change which setting? |
+-----------------------------------------------------------------------+
A:選擇硬件,可用以下命令查看:
liuxuzzz@liuxuzzz:~$ dmesg | grep cp2 [27694.924466] usbcore: registered new interface driver cp210x [27694.924478] usbserial: USB Serial support registered for cp210x [27694.924495] cp210x 3-1:1.0: cp210x converter detected [27694.924582] usb 3-1: cp210x converter now attached to ttyUSB0
可以發現最后一行,cp210x是ttyUSB0,所以A為/dev/ttyUSB0文件。
E:選擇波特率,一班就是115200,或者9600,與晶振有關。此處設置的參數意思是
波特率115200,8位數據,無奇偶校驗,1位停止位。
選擇完成后回車退出到主頁面,選擇“ Save setup as dfl ”保存配置並跳轉到rasp的gpio輸出。
成功如圖,可以看見系統啟動輸出(此時從新插拔電源才能看見,不然在登陸界面)。


