In the previous article the installation of Zephyr OS on the Raspberry Pico 2 (Linux) Part 1 was described, please follow that first, in order to perform the next steps. Here is a simple setup using a breadboard like one from DigiKey to configure the Raspberry Pico 2 W to connect it to the WiFi network in Zephyr OS shell,
(venv) $ west build -p always -b rpi_pico2/rp2350a/m33/w -S cdc-acm-console ../samples/net/wifi/shell -DCONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y -DCONFIG_SENSOR_INFO=y -DCONFIG_I2C_SHELL=y -DCONFIG_I2C=y -DCONFIG_NET_STATISTICS_WIFI=y -DCONFIG_NET_STATISTICS_USER_API=y
(venv) $ west flash --runner uf2
At the minicom terminal the Zephyr OS issue the following command.
uart:~$ wifi scan
Scan requested
Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP
1 | WLED-AP 7 | 1 (2.4GHz) | -89 | WPA2-PSK | B0:81:84:04:A3:B1 | Disable
2 | WLED-AP 7 | 1 (2.4GHz) | -88 | WPA2-PSK | B0:81:84:04:A3:B1 | Disable
3 | Content_Dev1 12 | 10 (2.4GHz) | -49 | WPA2-PSK | 5A:7E:1C:89:42:53 | Disable
Scan request done
At this point the Zephyr OS inside the Raspberry Pico 2 W displays the scanning result for the applicable WiFi network area. The results display the WiFi channels, the band, the receive signal strength indicator in dBm (-89 dBm, -88 dBm and -49 dBm in this case Content_Dev1 has the highest signal level), the type of security and other relevant parameters.
uart:~$ wifi connect -s "Content_Dev1" -p password
Passphrase provided without security configuration
Connected
Connection requested
[00:14:02.929,000] <inf> net_dhcpv4: Received: 192.168.157.37
where password is the applicable WiFi password now the Raspberry Pico 2 W running Zephyr OS has been connected to the WiFi network the router assigned an IP address of 192.168.157.37 via Dynamic Host Control Protocol.
Some network statistics can be displayed in the minicom terminal of Zephyr OS,
uart:~$ wifi statistics
Statistics for Wi-Fi interface 0x20000b10 [1]
Bytes received : 1032
Bytes sent : 631
Packets received : 3
Packets sent : 3
Receive errors : 0
Send errors : 0
Bcast received : 0
Bcast sent : 0
Mcast received : 0
Mcast sent : 0
Beacons received : 0
Beacons missed : 0
Unicast received : 0
Unicast sent : 0
Overrun count : 0
In the previous terminal the packets that have been received and sent by the Raspberry Pico 2 W running Zephyr OS are displayed.