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:
- Changes of the Wi-Fi connection status (SoftAP start/stop, Station connection/disconnection, IP address, ...)
- User interactions with the Webpage (LED toggling, Wi-Fi scan, ...)
- Execution errors
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.
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.
- This feature is only enabled when the WF200 chip behaves as a Station and is connected to an Access Point while the SoftAP interface is OFF. It is automatically disabled when the SoftAP interface is (re)started.
- Although the MCU low power and the WF200 chip Power Save feature independent from each other, we associated them to ease the example implementation.
- The SDIO bus cannot be used, as is, with the low power feature since the SDIO Out Of Band interrupt pin (GPIO_WIRQ) is not routed to the expander connector.
- An USB disconnection and reconnection may be necessary after programming the device in order to reach the lowest consumption levels.
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:
- Copy/paste the lwip_host/webpage/fs folder of your SDK in the same location inside your workspace.
- 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.
- Execute the makefsdata.exe or use the makefsdata provided by LwIP inside the SDK (location: util/third_party/lwip/lwip/src/apps/http/makefsdata).
- Rename the generated file fsdata.c into httpfsdata.h.
- Edit the file and remove include pragmas except #include "lwip/def.h".
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.
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:
- Find the associated define in the feature sources. The define name ends with _DEBUG, like HTTP_DEBUG, MQTT_DEBUG, TCP_DEBUG, ...
- Open the lwipopts.h file located in the lwip_host folder inside the project.
- Enable the global debug define LWIP_DEBUG in the top of the file.
- Enable the feature logs by adding the feature define inside the file and enabling it.
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.
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.
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:
- For PCs, install iPerf on your machine. Once installed, call the command below:
iperf -c 10.10.0.1
You simply need to issue this command as illustrated in the following image:
- For Android smartphones, install Magic iPerf using the Google Play Store. Open the application and enter the command above without the 'iperf'. Make sure [iPerf2] is selected. You can start the test by using the [Stopped] switch.
- For IOS smartphones, install HE.NET Network Tools using the Apple Store. Open the application and open the side menu to click on 'iperf'. Make sure 'TCP' is selected. Enter the number of bytes you want to send (e.g., 100 M) and finally enter the IP address in the upper text box (e.g., 10.10.0.1). The iPerf test starts.
Micrium OS 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 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.
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.
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.