21. PCIE网卡¶
野火IMX8M MINI开发板可以使用PCIE网卡来连接wifi和蓝牙
21.1. 使用PCIE wifi¶
前期准备
笔者使用的PCIE网卡为RTL8822ce,该模组是wifi+bt一体的模组,可以在我们的官方淘宝店购买。

在使用PCIE无线网卡模块时,我们需要先在/boot/uEnv.txt中打开PCIE的插件。
dtoverlay=/usr/lib/linux-image-5.4.47-carp-imx8mmini/freescale/overlays/imx8mm-fire-pcie.dtbo
将PCIE 模块插到开发板的PCIE接口上。
root@lubancat:~# dmesg | grep rtw
[ 4.878825] rtw_pci 0000:01:00.0: enabling device (0000 -> 0003)
[ 7.628910] rtw_pci 0000:01:00.0: start vif 48:8f:4c:f4:db:4d on port 0
[ 15.893407] rtw_pci 0000:01:00.0: sta 34:f7:16:dc:b7:5d joined with macid 0
iw是linux系统上的一款无线配置工具,使用以下命令下载iw工具。 关于iw工具的使用可以参考以下链接: https://wireless.wiki.kernel.org/en/users/documentation/iw
sudo apt update
sudo apt install iw
21.1.1. 操作步骤(与usb无线模块操作相差不多)¶
使用sudo ifconfig -a 查看网口相关信息,会增加一个wifi相关网卡wlan0
#命令
ifconfig -a
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 48:8f:4c:f4:db:4d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
使用sudo rfkill list all查看射频管理
#命令
sudo rfkill list all
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
使用sudo rfkill unblock all打开所有的射频
#命令
sudo rfkill unblock all
打开wifi
sudo ip link set wlan0 up
搜索附近的wifi
iw dev wlan0 scan | grep SSID
创建/etc/wpa_supplicant/wpa_supplicant.conf,存在则直接打开。文件配置wifi相关账号密码
network={
ssid="wifi账号"
psk="wifi密码"
priority=1
}
保存内容后退出,并使用以下命令连接wifi
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
申请动态ip
udhcpc -b -i wlan0
21.2. 使用PCIE 蓝牙¶
21.2.1. 操作步骤¶
使用命令行配置蓝牙,我们需要使用工具—-bluetoothctl
# 进入bluetoothctl命令行
bluetoothctl
# 进入bluetoothctl命令行后,类似:[bluetooth]#
# Controller代表arm板上的蓝牙设备,Device代表蓝牙耳机
# 按如下步骤初始化蓝牙设备,并连接蓝牙耳机
# 查看帮组
help
power on
agent on
default-agent
# 启动扫描
scan on
# 假如蓝牙耳机地址为:04:8C:9A:F2:54:4B
trust 04:8C:9A:F2:54:4B
# 配对
pair 04:8C:9A:F2:54:4B
# 连接
connect 04:8C:9A:F2:54:4B
# 查看蓝牙耳机信息
info 04:8C:9A:F2:54:4B
# 断开连接
disconnect 04:8C:9A:F2:54:4B
# 不想自动连接上蓝牙耳机,可以删除配对信息
remove 04:8C:9A:F2:54:4B
21.3. 常见问题¶
1.若不能成功连上wifi,请检查wifi账号密码是否正常,检查无误再尝试重新配置。