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.

Modify the Example

This section documents the procedures about how to modify the example to your needs. Each of the modifications will require a new compilation in order to be taken into account.

Modify the Wi-Fi SoftAP Configuration

The Wi-Fi SoftAP configuration (e.g. Name, Security mode) is located in the app_webpage.h file. The configuration can be modified by editing the file.

Modify the Wi-Fi Communication Bus

The WF(M)200 Expansion Board supports either SPI or SDIO communication bus, by default the project uses the SPI communication bus. But if the Silicon Starter Kit supports a SDIO communication, like the STK3701A (EFM32GG11), the WFx Bus SDIO component will appear in the Wi-Fi section of the component list. This list can be reached by opening the wifi_commissioning_micriumos.slcp file located at the root of the project. Please refer to the *Project Configurator** for more information about the Software Component list and Component Configuration.

To change the Wi-Fi bus communication:

  1. Open the UC component file named wifi_commissioning_micriumos.slcp located at the root of the project.
  2. Uninstall the WFx Bus SPI component in the Wi-Fi section. An Error window will pop up as a reminder that a bus needs to be installed, this normal.
  3. Install the WFx Bus SDIO component.

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

The WF(M)200 chip provides a feature called Secure Link allowing to encrypt the data exchanged between the chip and the MCU host preventing an attacker to retrieve critical information by probing the communication bus. This feature is disabled by default but can be enabled by installing the WFx Secure Link component available in the Wi-Fi section. Cryptographic resources will also be installed automatically, which can significatively increase the size of the generated binary.

Enable the Power Manager

One of the main characteristics of the WF(M)200 chip is its current consumption in Power Save mode. This mode is enabled by installing the Power Manager component, which will also put the MCU in deepsleep. The Power Manager component can be found in the Services section of the component list.

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. Simplicity Studio 5 also provides the Energy Profiler tool, this tool allows to measure the current consumption of a Silicon Labs Starter Kit. The measures being made by the Start Kir hardware, keep in mind that it is less accurate than a dedicated instrument, nevertheless it provides an idea of the current consumption quickly and easily. For more information about the Energy Profiler, please refer to this documentation.

Note:

Modify the Webpage

The Webpage sources are provided inside the SDK with the example in the lwip_host/webpage/fs folder but it doesn't appear in Simplicity Studio 5.

Follow the procedure below modify the webpage:

  1. Copy/paste the lwip_host/webpage/fs folder of your SDK in the same location inside your workspace.
  2. Edit and modify the index.shtml file to fit your needs. Tip: Another IDE (e.g. VS Code, Atom, ...) can be used to preview the page while changes are made.
  3. Execute the makefsdata.exe or use the makefsdata provided by LwIP inside the SDK (location: util/third_party/lwip/lwip/src/apps/http/makefsdata).
  4. Rename the generated file fsdata.c into httpfsdata.h.
  5. Edit the file and remove include pragmas except #include "lwip/def.h".

Debugging Tools

GDB

The toolchain provided with Simplicity Studio 5 contains a compiler, a linker, all you need to build a project, and it also contains a debugger. This debugger, called gdb, allows you to walk into the program step by step, to set breakpoints, to access the MCU memory and registers, ... For more information about how to use the debugger inside Simplicity Studio 5, please refer to the Using the debugger section of the Simplicity Studio 5 documentation.

Tip: Before starting a debug session, disable the project optimizations by selecting None from the Optimization Level list in the section [Optimization] of [Tools Settings] tab from the Project properties (Project->Properties->C/C++ Build->Settings). 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.

SEGGER SystemView

SEGGER SystemView is a powerful tool allowing to capture all the events (Task switching, Mutex/Semaphore acquisition and release, ...) in a Real-Time Operating System (RTOS) which is particularly helpful to define tasks priorities or to track a behavior leading to a Dead Lock. This tool supports Micrium OS and is provided free of charge with Simplicity Studio, it can be installed from the Simplicity Installation Manager by selecting [Install by connected device(s)] and [Advanced] options. For more information about how to use SEGGER SystemView with Micrium OS, please refer to this documentation.

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

Micrium OS Configuration

Debugging Configuration

The [Asserts Configuration] section accessible from the configuration of the [Micrium OS Common Module Core] component regroups all the checks that are done inside the Kernel to ensure the action previously done was successful. There can be a lot of checks and if the program behaves without triggering any of these assertions (enabled by default) then it can be considered to disable all or some debug assertions to see if it improves the performances.

Following the same idea, the debug helper present in the [Miscellaneous Configuration] section in the same configuration menu, can also be disabled.

Task Management Configuration

The [Task Management Configuration] section accessible from the configuration of the [Micrium OS Kernel] component regroups features that intervene during context switches for instance. Context switches happening continuously, any action can have a great impact, good or bad. The first features that can be disabled safely are the statistics and the profiling. Further steps can be taken by disabling the stackoverflow checking mechanism and the redzone, these actions can be critical and considered seriously.

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

Compilation Errors

Check the WF(M)200 Expansion Board Component

The WF(M)200 Expansion Board component is not installed automatically during the project creation. By default, the BRD8023A PDS is included in the project to avoid build problems. Although, the first step is to check in the component list if the UC component (BRD8022A or BRD8023A) related to your WF(M)200 Expansion Board is currently installed, to prevent WF(M)200 performance drop. Especially, if you get this warning WFX Board component (BRD8022A or BRD8023A) not installed in the console. Either directly enter the UC component name (BRD8022A or BRD8023A) related to your WF(M)200 Expansion Board or expand the section Software Component/Platform->Board->Expansion Board in the UC component list and make sure the UC component is installed.

Force a Project Generation

If the requirement above is satisfied but compilation errors subsist, it can means that the project and the source code are misaligned after a component addition or removal. This kind of errors can be resolved by forcing a new project generation from the [Project Details] tile of the [Overview] tab accessible from the SLCP project file and launch a new build. A project generation won't cause any loss as long as you don't directly modify the files contained in the autogen and config folders.

Example Malfunctions

Connecting a Silicon Labs 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 Logs from the Console

The section Start the Example describes the procedure to launch a console inside Simplicity Studio 5.

Check the Hardware Connections

Check the boards connection to ensure that the WF(M)200 Expansion Board is inserted tightly into the 20-pin expansion header of the Silicon Labs Starter Kit, as described in section Setup your Kit. Make sure that all the switches are in the correct position, as described in section Setup your Kit.

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 or WPA2.

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.

If the demo has been modified, such as by adding an additional task or modifying task priorities, see the Micrium OS Kernel Troubleshooting Guide at: https://doc.micrium.com/display/OSUM50700/Kernel+Troubleshooting.