WiFi
The Luckfox Pico Zero is equipped with the AIC8800DC module, supporting the WiFi AX protocol (WiFi 6), and compatible with 2.4GHz WiFi and Bluetooth 5.2/BLE.By default, the development board uses an external antenna. To switch to the onboard chip antenna, simply pull up GPIO pin 123. The steps are as follows:
echo 123 > /sys/class/gpio/export
cd /sys/class/gpio/gpio123
echo out > direction
echo 1 > value
WiFi
Buildroot Connection WiFi
Edit the WiFi configuration file using
viornanoeditornano /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1
network={
ssid="luckfox"
psk="12345678"
key_mgmt=WPA-PSK
}ssid: Name of the wireless networkpsk: Password of the wireless networkModify according to your actual wireless network name and password. No need to change other settings.
If you want to switch WiFi networks, you need to restart the
wpa_supplicantservice:killall -9 wpa_supplicant
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.confConnect to the wireless network.
udhcpc -i wlan0Note: These settings will be lost after reboot. To persist the configuration, you’ll need to write a startup script (for onboard antenna).
#!/bin/sh
GPIO_NUM=123
WPA_CONF="/etc/wpa_supplicant.conf"
echo_log() {
echo "[wifi-autostart] $1"
}
case "$1" in
start)
echo_log "Exporting and setting GPIO${GPIO_NUM} high..."
[ ! -d "/sys/class/gpio/gpio${GPIO_NUM}" ] && echo "${GPIO_NUM}" > /sys/class/gpio/export
echo out > "/sys/class/gpio/gpio${GPIO_NUM}/direction"
echo 1 > "/sys/class/gpio/gpio${GPIO_NUM}/value"
echo_log "Starting wpa_supplicant..."
killall -q wpa_supplicant
wpa_supplicant -B -i wlan0 -c "${WPA_CONF}"
echo_log "Requesting IP address via udhcpc..."
udhcpc -i wlan0
echo_log "WiFi setup complete."
;;
stop)
echo_log "Stop command received. Stopping wpa_supplicant..."
killall -q wpa_supplicant
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esacAccording to the above configuration method, the settings will be lost after reboot. Therefore, you need to create a startup script to reapply them (for external antenna use).
nano /etc/init.d/S99wlan0#!/bin/sh
case $1 in
start)
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
udhcpc -i wlan0
;;
stop)
;;
*)
exit 1
;;
esacchmod +x /etc/init.d/S99wlan0
reboot
WiFi Speed Test
On the virtual machine or host
iperf3 -s -i 10 -p 5001-s: Specifies that iperf3 runs in server mode-i: Sets the report interval to 10 seconds-p: Specifies the server port as 5001
On the development board
iperf3 -c 192.168.10.176 -p 5001 -f m -i 2 -t 24-c:指定客户端模式,并设置要连接的服务器IP地址为192.168.10.176-p:指定服务器端口为5001-f:指定报告的格式。m代表 Mbps,即报告的带宽单位为兆比特每秒-i:指定报告的间隔时间为每1秒-t:指定测试的持续时间为30秒
Bluetooth
Due to certain dependencies of the BlueZ tools in Buildroot only supporting glibc and not ulibc, the tool cannot be used.
Setting ttyS1 as a Bluetooth HCI device:
# Older driver version
hciattach -s 115200 /dev/ttyS1 any 115200 flow nosleep&
# Newer driver version
hciattach -s 1500000 /dev/ttyS1 any 1500000 flow nosleep&Enabling hci0:
hciconfig hci0 upChecking Bluetooth status:
hciconfig -a
#蓝牙详细信息
hci0: Type: Primary Bus: UART
BD Address: 90:E4:68:A6:D6:94 ACL MTU: 1021:9 SCO MTU: 255:4
UP RUNNING
RX bytes:1344 acl:0 sco:0 events:77 errors:0
TX bytes:1217 acl:0 sco:0 commands:77 errors:0
Features: 0xbf 0xee 0xcd 0xfe 0xd8 0x3d 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
Link policy: RSWITCH SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'BlueZ 5.65'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: 5.2 (0xb) Revision: 0x14
LMP Version: 5.2 (0xb) Subversion: 0x14
Manufacturer: not assigned (2875)Scanning for Bluetooth devices:
hcitool scanBluetooth testing:
hcitool cmd xxxx