STM32F4: Bare Metal + LwIP Wi-Fi FMAC Driver Example
This demonstration example runs the Wi-Fi FMAC driver meant to communicate with the WF200/WFM200 Silicon Labs Wi-Fi transceivers. The example includes the LwIP IP stack, a Web server, DHCP client, a TCP iPerf server/client implementation... This example is a bare metal implementation of the FMAC driver.
- An Arduino/NUCLEO interposer (Available through support ticket request, more information in the Additional Information section) or some flying wires
- A NUCLEO-F429ZI development board
- A micro USB cable
- A PC to load a binary file in the NUCLEO board or to compile the IAR/TrueSTUDIO projects. In addition, it can be used to test the example if it is equipped with a Wi-Fi interface.
In addition to the previous hardware, a user needs software listed below:
- The software example named WF200_driver_F429ZI_BM-LwIP available on GitHub
- Licensed IAR Embedded Workbench IDE for ARM installed or Atollic TrueSTUDIO for STM32 IDE
- The correct ST-link driver installed on your machine
- A serial terminal to communicate with the NUCLEO-F429ZI board. For example, Tera Term or Putty
After you have the above resources, follow the steps described below (you can refer to the image below):
- Connect the Arduino/Nucleo interposer board to the NUCLEO-F429ZI board.
- Connect the WF200 expansion kit to the Arduino/Nucleo interposer board.
- Make sure the "Power" switch on the WF200 expansion kit is in the "On Board LDO" position.
- Select SPI or SDIO on the bus switch depending on the bus you want to use.
- Connect the NUCLEO board to your PC using the USB cable. The board should appear as a mass storage device named "NODE_F429ZI".
Using the Binary Files
The first option to run the demo is to use the precompiled binaries provided under wfx-fullMAC-tools/Examples/STM32/Projects/WF200_driver_F429ZI_BM-LwIP/Binaries/. Depending on the bus selected on the switch, choose the corresponding binary file:
To use this method, drag-and-drop or copy the WF200_driver_F429ZI_BM-LwIP_xxx.bin file to the "NODE_F429ZI" mass storage. Once the STM32 successfully flashed, you can jump to the Using the Demo section.
Compiling the Project
Alternatively, use your preferred IDE to compile and flash the project into the NUCLEO board.
- Open the project with either IAR or TrueSTUDIO IDEs.
- Select the bus configuration (SPI or SDIO). Make sure it matches the switch position on the WF200 EXP board.
- To modify the default Wi-Fi settings, open the header file WF200_driver_F429ZI_BM-LwIP/Inc/demo_config.h. Using the defines, you can change the information used by the example and the default mode in which the WF200 starts (station or softAP mode).
#define SOFT_AP_MODE_DEFAULT 1 ///< If set to 1, default Wi-Fi is softAP mode (requires static IP) #define USE_DHCP_CLIENT_DEFAULT 0 ///< If defined, DHCP is enabled, otherwise static address below is used #define WLAN_SSID_DEFAULT "AP_name" ///< Wi-Fi SSID for client mode #define WLAN_PASSKEY_DEFAULT "passkey" ///< Wi-Fi password for client mode #define WLAN_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< Wi-Fi security mode for client mode #define SOFTAP_SSID_DEFAULT "WF200_AP" ///< Wi-Fi SSID for soft AP mode #define SOFTAP_PASSKEY_DEFAULT "12345678" ///< Wi-Fi password for soft AP mode #define SOFTAP_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< Wi-Fi security for soft AP mode #define SOFTAP_CHANNEL_DEFAULT 6 ///< wi-fi channel for soft AP
- Build the project.
- Flash the project to the NUCLEO-F429ZI board.
After the STM32 is successfully flashed, jump to the Using the Demo section.
Using the Demo
- Open a serial terminal and connect to the COM port of the NUCLEO board using 115200 bps for the speed.
- Reset the NUCLEO board using the black button.
- You should see similar traces as below appear on the serial terminal:
WF200 init successful AP started MAC address : 00:0D:6F:73:88:AA IP address : 192.168.0.1
- By default, the example starts in the SoftAp mode using the SSID and passkey below:
- SSID: WF200_AP
- Passkey: 12345678
You can use this information to join the network established by the WF200.
Make sure your Wi-Fi interface is configured to use a static IP address and is part of the same network as the address 192.168.0.1 (192.168.0.2 for example). The bare metal example does not come with a DHCP server, which would allow the use of dynamic IP addresses.
To use the example in station mode, recompile the project using IAR or TrueSTUDIO IDEs by changing the example configuration in the header file "demo_config.h", as explained in Compiling the Project section. The example behaves the same as in softAP mode, the difference being that it needs to connect to a Wi-Fi access point and retrieve its IP address using DHCP.
- In both cases, a Web page is hosted in the STM32. It gives control over the board LEDs. After your PC is configured to use static address on the Wi-Fi interface and you are connected to the WF200_AP access point, open a Web browser and type 192.168.0.1 (or the IP address is displayed on the serial interface in case the example acts as station). You should see the Web page below appear.
Toggling the On/Off buttons switches the corresponding LED state and displays a message on the serial interface. In addition, pressing the User Button (blue button) on the NUCLEO board will start a Wi-Fi scan sequence. The result is output on the serial interface as shown below.
! # Ch RSSI MAC (BSSID) Network (SSID) # 1 1 -72 DC:4A:3E:1B:C3:83 DIRECT-82-HP ENVY 5640 series # 2 6 -64 E2:55:7D:B3:23:30 Agence-2.0-WIFI-GUEST # 3 6 -43 B0:6E:BF:9B:E2:48 ASUS_WaveAgent # 4 11 -80 92:2A:A8:81:4A:DF SiliconLabs # 5 10 -48 B0:6E:BF:D9:F3:88 ASUS_AJEA Scan completed
- Finally, using the same IP address, you can start an iPerf TCP test between the WF200 and another device. First install iPerf on your machine. After it is installed, call the command below on your machine:
iperf -c [IP address displayed] -i 1
By default, the test is 10 seconds long. After the iPerf test is over, a report is output on the serial interface.
Iperf Server Report: Duration 10083ms Bytes transferred 6887976 5464 kbit/s
For customer support:
- Register on https://www.silabs.com/.
- Go to Community & Support → Technical Support → E-mail Support Request.