FRDM RW612 - zephyr rtosでwifiを使用してみる。
- はじめに
NXPのWi-Fi対応マイコン評価ボード「[FRDM-RW612] (https://www.nxp.jp/design/design-center/development-boards-and-designs/FRDM-RW612)
および、zephyrのサンプルアプリケーションプログラム(samples/net/wifi/shell)を使用して、wifiの動作を確認してみた際の記録メモです。
- 作業環境
VirtualBox7.1.4で、Ubuntu24.04 LTSを使用
Windows11 - オンボードデバッグプローブのファームウェア書き換えに使用
- 参照情報
- [Zephyr Project - FRDM-RW612 Board Documentation]
https://docs.zephyrproject.org/latest/boards/nxp/frdm_rw612/doc/index.html - [NXP FRDM-RW612 User Manual (PDF)]
https://www.mouser.com/pdfDocs/NXP_FRDM-RW612_UM.pdf?srsltid=AfmBOop9qYeD7uenZyGnZhN0m7sVRtWD7BetTHhNRyKzaS_fYf9_WFCT - [NXP MCUXpresso SDK - Updating MCU-Link Firmware]
https://mcuxpresso.nxp.com/mcuxsdk/25.09.00/html/boards/Wireless/frdmrw612/gettingStarted/topics/updating_mcu-link_firmware.html
- [Zephyr Project - FRDM-RW612 Board Documentation]
- FRDM-RW612の技術適合取得情報の有無
- 工事設計認証番号: 210-244136
- 総務省の「[技術基準適合証明等を受けた機器の検索]
上記番号を検索可能
https://www.tele.soumu.go.jp/giteki/SearchServlet?pageID=js01
-
MCU-Linkデバッグプローブのファームウェアの書き換え(Windowsで作業)
-
デフォルトでは、J-Link用のfirmwareが書き込まれている。
-
CMSIS-DAP用のfirmwareへ書き換える場合は、
基板上のJ2ピンをショートした状態でさせた状態のまま、PCへUSB接続して基板を起動、
MCU-LINKと呼ばれるユーティリティを用いて書き換える。(詳細は、参照情報を参照)。
本確認では、CMSIS-DAP用のfirmwareへ書き換えて確認を行っている。 -
書き換え対応方法
- Windows用のユーティリティを用いて書き換え。
- LinkServer_26.3.123.exeを使用。
- ユーティリティのダウンロード先:
https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKSERVER - LinkServer_26.3.123.exe実行後、C:\NXP\MCU-LINK_installer_3.172\scriptsにスクリプトが格納されているので実行する。
- CMSIS-DAP用に書き換えるため、program_CMSIS.cmdを使用。(JLink用も同一フォルダにある。ファイル:program_JLINK.cmd)
program_CMSIS.cmd実行結果CMSIS-DAP firmware for MCU-Link programming script V3.172 March 2026. Place the board in ISP USB mode using the appropriate jumper on your MCU-Link. Refer to the board documentation for more information. Connect board via USB then press Space. WARNING: This firmware version requires MCUXpresso IDE version 11.7.1 or later. 続行するには何かキーを押してください . . . Programming "MCU-LINK_CMSIS-DAP_V3_172.s19" Programmed successfully - To use: remove ISP jumper and reboot. Connect Next Board then press Space (or CTRL-C to Quit) 続行するには何かキーを押してください . . .書き換えが成功したら、J2のショートを外し、基板を再起動。
-
-
LinkServer probeによる基板の接続状況確認(Ubuntuで作業)
FRDM-MCXN947の確認
(https://qiita.com/mana_t/items/d1123726581914a0597b)
の際と同様のコマンド、LinkServerのprobesを使用して、接続を確認。
(CMSIS-DAP用に書き換える前は、LinkServer probesの実行に対して、何も出力されない状態となる。)。$ sudo /usr/local/LinkServer_26.3.123/LinkServer probes # Description Serial Device Board Capabilities --- ----------------------------------------- ------------- -------- ------- ---------------- 1 MCU-LINK on-board (r0E7) CMSIS-DAP V3.172 DCG43LSIHUOOH DEBUG, VCOM, SIO
- サンプルアプリケーション(samples/net/wifi/shell/)のビルドと書き込み
- ビルド前の事前対応
wifiの利用にあたりbinary blobが必要になるので、以下のwestコマンドでダウンロードする。
$ west blobs fetch hal_nxpwestコマンド実行結果抜粋$ west blobs fetch hal_nxp Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/iw612/uart_nw61x_se.h Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/rw61x/rw61x_sb_ble_15d4_combo_a2.bin Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/rw61x/rw61x_sb_ble_a2.bin Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/rw61x/rw61x_sb_wifi_a2.bin Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw23/libble_ll_os.a Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw23/libble_ll_utils_os.a Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw71/mcxw71_nbu_ble.sb3 Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw72/mcxw72_nbu_ble_all_hosted.bin Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw71/mcxw71_nbu_ble_15_4_dyn.sb3 Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/mcxw72/mcxw72_nbu_ble_15_4_dyn.bin Fetching blob hal_nxp: /home/zephyr/dev_env/zephyrproject/modules/hal/nxp/zephyr/blobs/nw61x/sd_nw61x.bin.se For this blob, need to read and accept license to continue. Read it? Please type 'y' or 'n' and press enter to confirm: Please type 'y' or 'n' and press enter to confirm: y ~中略~ Vivante: Distribution of Vivante software must be a part of, or embedded within, Authorized Systems that include a Vivante Graphics Processing Unit. Accept license to continue? Please type 'y' or 'n' and press enter to confirm: Please type 'y' or 'n' and press enter to confirm: y $- ビルド
$ west build -b frdm_rw612 samples/net/wifi/shell/ -p always- 書き込み
$ sudo env "PATH=/usr/local/LinkServer_26.3.123:$PATH" $(which west) flash -r linkserver - ビルド前の事前対応
-
アプリケーションの実行
- サンプルアプリケーションは、wifiステーション機能を利用できるので、
接続前のスキャン動作の使用例を示す。
スキャンuart:~$ wifi scan Scan requested Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP 1 | Buffalo-A-BB10-WPA3 19 | 44 (5GHz ) | -41 | WPA3-SAE-HNP | 90:96:F3:E2:BB:1A | Required 2 | Buffalo-G-BB10 14 | 6 (2.4GHz) | -29 | WPA2-PSK | 90:96:F3:E2:BB:12 | Optional 3 | Buffalo-G-BB10-WPA3 19 | 6 (2.4GHz) | -28 | WPA3-SAE-HNP | 90:96:F3:E2:BB:13 | Required ~中略~ 10 | Buffalo-A-BB10 14 | 44 (5GHz ) | -41 | WPA2-PSK | 90:96:F3:E2:BB:19 | Optional Scan request done- スキャン結果で出力される、Num 3(SSID: Buffalo-G-BB10-WPA3)のアクセスポイントに接続する例を示す。
例で示されるパラメータは下記になる(コマンドwifi helpから抜粋)。
-s <-s --ssid "">: SSID.
-p [-p, --passphrase]: Passphrase (valid only for secure SSIDs)
-k [-k, --key-mgmt]: Key Management type (valid only fo secure SSIDs)
-w [-w, --ieee-80211w]: MFP (optional: needs security type to be specified)
接続uart:~$ wifi connect -s Buffalo-G-BB10-WPA3 -p 3ndrbwfbm5vy3 -k 3 -w 2 Connection requested ~中略~ uart:~$ wifi status Status: successful ================== State: COMPLETED Interface Mode: STATION Link Mode: WIFI 6 (802.11ax/HE) SSID: Buffalo-G-BB10-WPA3 BSSID: 90:96:F3:E2:BB:13 Band: 2.4GHz Channel: 6 Security: WPA3-SAE-HNP MFP: Required RSSI: -29 Beacon Interval: 100 DTIM: 0 TWT: Supported Current PHY TX rate (Mbps) : 77.0 uart:~$ net ping 192.168.11.1 uart:~$ PING 192.168.11.1 28 bytes from 192.168.11.1 to 192.168.11.3: icmp_seq=1 ttl=64 time=14 ms ~中略~ uart:~$ - サンプルアプリケーションは、wifiステーション機能を利用できるので、
-
サンプルアプリケーション(samples/net/wifi/shell/)を使ってアクセスポイントを使用
- wifiアクセスポイント機能の有効化
サンプルアプリケーション(samples/net/wifi/shell/)はデフォルトの状態は、ステーション機能のみを有効にしており、アクセスポイントの機能は無効となっている。機能を有効にするために、サンプルアプリケーションのprj.confに以下を追加する。
機能確認上、ステーション機へのIPアドレスの割り当ても併せて確認したためDHCPサーバ機能も有効にしている。
samples/net/wifi/shell/prj.confCONFIG_WIFI_USAGE_MODE_STA_AP=y CONFIG_NET_DHCPV4_SERVER=y CONFIG_NET_IF_MAX_IPV4_COUNT=2 CONFIG_NET_CONFIG_SETTINGS=n CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT=5- wifiアクセスポイントの起動例
例で示されるパラメータは下記になる(コマンドwifi ap helpから抜粋)。
対向となる機器からの接続し、対向となる機器にIPアドレスが割り当てられる。
-s --ssid=
-c --channel=
-p --passphrase= (valid only for secure SSIDs)
-k --key-mgmt= (valid only for secure SSIDs)
アクセスポイントの起動uart:~$ wifi ap enable -s "FRDM_RW612_AP" -p "password123" -k 1 -c 6 AP mode enable requested uart:~$ uart:~$ net iface Default interface: 1 Interface ml (0x10041c28) (WiFi) [1] =============================== Interface is down. Interface ua (0x10041d68) (WiFi) [2] =============================== Interface is down. uart:~$ uart:~$ net ipv4 add 2 192.168.10.1 255.255.255.0 uart:~$ net dhcpv4 server start 2 192.168.10.10 DHCPv4 server started on interface 2 Station connected: 92:10:0D:60:AC:A0 ~中略~ uart:~$ net ping 192.168.10.10 PING 192.168.10.10 28 bytes from 192.168.10.10 to 192.168.10.1: icmp_seq=1 ttl=64 time=45 ms ~中略~ 28 bytes from 192.168.10.10 to 192.168.10.1: icmp_seq=3 ttl=64 time=66 ms - wifiアクセスポイント機能の有効化