Bootstrap

串口连接树莓派

 在没有显示器以及网络配置弄乱了,无法再通过笔记本连上树莓派时,就需要使用串口来连接树莓派对其网络进行配置。

笔记本通过串口连接树莓派

  1. 须准备一个USB转串口模块,插到电脑上后在电脑得设备管理器中将识别到一个COM口,如果未识别或者有感叹号则可能需要安装模块对应驱动。

  1. 在电脑正确识别到串口后,将串口得TXD、RXD、GND引脚连接树莓派得RXD、TXD、GND引脚(具体连接见图片),然后笔记本上打开任一串口软件连接1中识别COM口,这里我使用得是SecureCRT,具体配置信息见图片。

  2. 软件连接成功后,给树莓派上电将在串口软件上看到树莓派的启动信息,输入用户名密码即登录成功。

配置树莓派网络信息

  1. 输入如下指令打开编辑网卡配置文件,eth0为有线网卡,wlan0为无线网卡。无线网卡当前配置为自动获取IP,无线名称及密码:
pi@raspberrypi:~$ sudo vi /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
#iface wlan0 inet static
#address 192.168.0.66
#netmask 255.255.255.0
#gateway 192.168.0.1
wpa-ssid "wifi名称"
wpa-passphrase "wifi密码"
  1. 保存网卡配置,重启网卡,查看网卡ip地址。
pi@raspberrypi:~$ sudo service networking restart
pi@raspberrypi:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4  bytes 156 (156.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 156 (156.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.33.11  netmask 255.255.255.0  broadcast 192.168.33.255
        inet6 fe80::ba27:ebff:fe6e:bac1  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:6e:ba:c1  txqueuelen 1000  (Ethernet)
        RX packets 220  bytes 15874 (15.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 14489 (14.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

远程连接树莓派

windows系统打开远程桌面,连接上一步查询到的ip,输入用户名密码后远程操作树莓派。


树莓派参数
型号:Raspberry Pi 3B+
CPU: BCM2837B0 64-位 1.4GHz 4核
接口:蓝牙4.2、双频Wifi、千兆有线网口、4xUSB2.0

;