Further Steps

Wi-Fi Commissioning Logs

The example outputs logs on the serial port, this logs allows to keep track of the program execution by tracing information about:

The image below illustrates logs displayed in the serial console during a Wi-Fi commissioning process.

Change the Default Settings

By Using the Prompt

By default the application starts by setting up a SoftAP which has hardcoded name. If you want to change the application behavior and directly start as a Station or if you want to start a SoftAP with a different name, a first solution is to press Enter within the 5 seconds after the microcontroller boot to start the prompt. The prompt allows to start in the desired mode and to select the Wi-Fi information (SSID, Passkey and Security mode). Note that this solution is not persistent to reboots or resets.

By Editing and Recompiling the Project

Compared to the previous method, this method is persistent to reboots or resets. The default settings, especially the settings related to the SoftAP (SSID, Passkey, Security mode and IP address) are defined in the demo_config.h file. You can change the default settings by editing this file, making the needed changes and recompiling the project.

Change the Wi-Fi Communication Bus

The project file of the example provides 2 configurations to select the Wi-Fi Communication bus (SPI / SDIO) and the compiled binaries related to these configurations are also provided in the Binaries folder. Either directly flash the binary corresponding to the desired configuration or select the desired configuration in your IDE, build the project and flash the device with the generated binary.

Don't forget to put the bus switch of the WF(M)200 Expansion Board accordingly.

Enable the Low Power Feature

The project file of the example provides a configuration enabling the low power on both the MCU and the WF(M)200 chip. Either directly flash the provided binary or select the configuration in your IDE, build the project and flash the device with the generated binary.

You can refer to the AN1219: Power Consumption Measurement Setup and Results on WF(M)200 document to perform measurements on the WF(M)200 chip.

Notes:

Modify the Webpage

The Webpage sources are provided with the GitHub example in the Examples/STM32/shared/Middlewares/Third_Party/LwIP/src/apps/http/fs folder.

Follow the procedure below modify the webpage:

  1. Edit and modify the index.shtml file to fit your needs. Keep in mind that all changes can be reverted thanks to the Git versioning. Tip: Another IDE (e.g. VS Code, Atom, ...) can be used to preview the page while changes are made.
  2. Execute the makefsdata.exe (at the location Examples/STM32/shared/Middlewares/Third_Party/LwIP/src/apps/http ).
  3. Rebuild the project and flash the device.

Debugging Tools

GDB

Most toolchains provided by the Integrated Development Environments (IDE) provides a debugger. It allows you to walk into the program step by step, to set breakpoints, to access the MCU memory and registers, ... Making it an essential tool when tracking a bug or simply to better understand the program execution.

Tip: Before starting a debug session, make sure to disable the compiler optimizations accessible through your IDE in the project properties. By default the project is built using the highest optimization setting to have the highest Wi-Fi performances, making the debug experience painful since the instructions are reorganized, so the program will give the impression not to execute linearly.

Additional Logs

Always with the aim to have the highest possible Wi-Fi performances, only few logs are enabled and they are related to actions happening times to times. Nevertheless, having more logs is often good to track a bug or better understand a program behavior. In that purpose LwIP provides logs in each feature of the stack. These logs are disabled by default but can be enabled by editing the lwipopts.h file of the project. The file purpose is to configure the stack IP, like the features enabled or disabled.

To enable logs related to a specific feature:

  1. Find the associated define in the feature sources. The define name ends with _DEBUG , like HTTP_DEBUG, MQTT_DEBUG, TCP_DEBUG, ...
  2. Open the lwipopts.h file located in the lwip_host folder inside the project.
  3. Enable the global debug define LWIP_DEBUG in the top of the file.
  4. Enable the feature logs by adding the feature define inside the file and enabling it.

Optimization Considerations

This section describes steps to increase the throughput while keeping a minimum footprint necessary for your application. The first portion of this document describes the recommended tools. The second portion describes the firmware changes necessary to tweak the performance.

Optimization Tools

iPerf

iPerf is a well-known tool used to measure the throughput on an IP link. This example starts a TCP Server for iPerf testing by default, allowing you to check the throughput after tweaking the program configuration and see the impact. When enabled, the TCP Server for iPerf will be listening for incoming connections at any time. The method to start an iPerf test is dependent on the platform you are using to run the iPerf client:

iperf -c 10.10.0.1

You simply need to issue this command as illustrated in the following image:

Optimization Settings

LwIP Configuration

LwIP is an IP stack providing a great granularity to tweak the configuration and reach the best performances. This configuration can be modified by editing the lwipopts.h file located in the lwip_host folder inside the project. The dedicated Maximizing throughput article will help you focus on the main variables to reach the highest performances.

Enabling the LwIP statistics is particularly helpful to dimension the different memory pools. The statistics are enabled as follows in the lwipopts.h file.

#define  LWIP_STATS                                      1
#define  LWIP_STATS_DISPLAY                              1

This allows to output the statistics in the console by adding a call to the function stats_display() in your application.

Wi-Fi FMAC Driver Documentation

For your own application development or for more information about the Wi-Fi FMAC Driver, please refer to the documentation .

Troubleshooting

Connecting the STM32 MCU Starter Kit associated to a WF(M)200 Expansion Board to your Wireless Network is a complex process. If any of the steps in the process is not done correctly, failure can occur. This section describes a few basic steps you can take to troubleshoot this demo.

Check the Debugging Messages from a Serial Terminal

Open a serial terminal as described in the section Start the Example .

Check the Hardware Connections

Check the boards connection to ensure that the WF(M)200 Expansion Board is inserted tightly into the Arduino/Nucleo interposer, as described in section Set up your Kit . Also make sure that all the switches are in the correct position, as described in the same section.

Verify Wi-Fi Access Point Settings

Use your Wi-Fi router’s (i.e., AP) administrative GUI to verify network settings for the wireless network Service Set Identifier (SSID) to which your WF(M)200 Wi-Fi module is trying to connect. Locate the SSID that you are troubleshooting. On a basic Wi-Fi router, there may be just one SSID, or one for each radio band (2.4 GHz and 5 GHz). If your WF(M)200 and Wi-Fi AP or router can hear each other but still cannot connect or exchange traffic, look for a security mismatch. Configure the Wi-Fi AP or Router to one of the security modes the WF(M)200 supports: Open, WEP, WPA, WPA2 or WPA3.

Verify Network Connection with Ping

If your WF(M)200 still can't connect but you are unable to display the Webpage, check the IP address provided to the WF(M)200. Notice that the WF(M)200 falls back to a default IP address (192.168.0.1) if no IP address is provided by the Wi-Fi AP after a certain time (several tens of seconds). Check that a DHCP server is running on your Wi-Fi router and identify the IP subnet assigned upon a successful connection. Identify the Wi-Fi router’s local IP address that should be reachable through this subnet. Check your Wi-Fi router's events log or status GUI to verify that an IP address from this subnet is assigned to your WF(M)200 when it connects. After your WF(M)200 has a valid IP address, meaning an IP address from the subnet identified earlier, use a ping command from another station or from your Wi-Fi router to verify that your WF(M)200 is connected to the network and is reachable.

Check Wireless-Specific Issues

If your WF(M)200 still can't connect, get a valid IP address or ping your Wi-Fi router. Then, it's time to consider wireless-specific problems. The Wi-Fi AP or router and WF(M)200 must use compatible 802.11 standards and the same network name (SSID). Use your AP or router's admin GUI to view WLAN settings and compare them to your embedded application's wireless connection parameters. Run the scan command in the Serial Console and verify that your Wi-Fi AP or Router is displayed in the list. If your SSID does not appear in the WF(M)200's Available Networks list, enable SSID broadcasts on your AP or router. Be sure to match the SSID exactly, including capitalization.

Check Intermittent Network Connectivity Issues

Finally, if your WF(M)200 connects and pings successfully, but encounters intermittent network connectivity problems (e.g., some pings work, some fail), you may be experiencing poor signal strength, RF interference, or if the demo has been modified, a software-related problem.