在Mac下使用PL2303HX进行串口调试

1.基于CH341的USB转串口,在Mac下是不支持的。所以自己去买了一个PL2303HX。

Screen Shot 2013-08-05 at 下午12.55.40

2、串口模块连接到电脑后,可以在系统报告中看到以下信息

Screen Shot 2013-08-05 at 下午12.51.09

PL2303HX需要连接三根线:
USB转TTL小板 TX 连接 单片机P3.0(RX)
USB转TTL小板 RX 连接 单片机P3.1(TX)
USB转TTL小板 GND 连接 单片机GND

按以上方式通过USB连接好板子后就可以使用Minicom查看日志了。

3、通过brew安装minicom

1
➜ / >brew install minicom

4、进入minicom

1
➜ / >minicom -s

5、会进入这个页面,选择Serial port setup

1
2
3
4
5
6
7
8
9
10
11
 +-----[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        |
+--------------------------+

4.修改Serial Device为当前连接的串口设备,一般就是tty.usbserial,可以在dev目录下找到。

1
2
3
4
➜ / >cd /dev
➜ /dev >ls | grep usbserial
cu.usbserial
tty.usbserial
1
2
3
4
5
6
7
8
9
10
11
+-----------------------------------------------------------------------+
| A -    Serial Device      : /dev/modem                                |
| B - Lockfile Location     : /usr/local/Cellar/minicom/2.6.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?                                              |
+-----------------------------------------------------------------------+

5、比特率选择115200然后退出,就连接到串口了。

1
2
3
4
5
6
7
Welcome to minicom 2.6.1

OPTIONS:
Compiled on Jul 15 2013, 08:59:51.
Port /dev/tty.usbserial

Press Meta-Z for help on special keys