HTTP Client (IPv6)#
1. Purpose / Scope#
This application demonstrates how to create Silicon Labs device as HTTP/HTTPs client and do HTTP PUT, GET and POST operations with the HTTP server opened on remote peer. In this application, the device configures as Wi-Fi station and connects to Access point and do HTTP/HTTPs PUT, GET and post operation with HTTP server opened on remote peer.
2. Prerequisites / Setup Requirements#
Before running the application, the user will need the following things to setup.
2.1 Hardware Requirements#
Windows PC with Host interface (UART / SPI/ SDIO).
Silicon Labs RS9116 Wi-Fi Evaluation Kit
Host MCU Eval Kit. This example has been tested with:
Silicon Labs WSTK + EFR32MG21
Silicon Labs WSTK + EFM32GG11
Windows PC (Remote PC) with iperf application
2.2 Software Requirements#
Embedded Development Environment.
For STM32, use licensed Keil IDE
For Silicon Labs EFx32, use the latest version of Simplicity Studio.
Windows PC with openssl support and python installed.
3. Application Build Environment#
3.1 Platform#
The Application can be built and executed on below Host platforms
3.2 Host Interface#
By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.
3.3 Project Configuration#
The Application is provided with the project folder containing Keil and Simplicity Studio project files.
Keil Project
The Keil project is used to evaluate the application on STM32.
Project path:
<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-nucleo-f411re.uvprojx
Simplicity Studio
The Simplicity Studio project is used to evaluate the application on EFR32MG21.
Project path:
If the Radio Board is BRD4180A or BRD4181A, then access the path
<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd4180a-mg21.slsproj
If the Radio Board is BRD4180B or BRD4181B, then access the path
<SDK>examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd4180b-mg21.slsproj
User can find the Radio Board version as given below
EFM32GG11 platform
The Simplicity Studio project is used to evaluate the application on EFM32GG11.
Project path:
<SDK>examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd2204a-gg11.slsproj
3.4 Bare Metal/RTOS Support#
This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.
4. Application Configuration Parameters#
The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.
4.1 Open rsi_http_client_app.c file#
4.1.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.#
SSID refers to the name of the Access point to be created.
#define SSID "SILABS_AP"
CHANNEL_NO refers to the channel in which AP would be started
#define CHANNEL_NO 11
SECURITY_TYPE refers type of security. Access point supports Open, WPA, WPA2 securities.
Valid configurations are:
RSI_OPEN - For OPEN security mode
RSI_WPA - For WPA security mode
RSI_WPA2 - For WPA2 security mode
#define SECURITY_TYPE RSI_WPA2
ENCRYPTION_TYPE refers to the type of Encryption method. Access point supports OPEN, TKIP, CCMP encryption methods.
Valid configurations are:
RSI_CCMP - For CCMP encryption
RSI_TKIP - For TKIP encryption
RSI_NONE - For open encryption
PSK refers to the secret key if the Access point to be configured in WPA/WPA2 security modes.
#define PSK "1234567890"
To Load certificate
#define LOAD_CERTIFICATE 1
To configure IP address DHCP_MODE refers whether IP address configured through DHCP or STATIC.
#define DHCP_MODE 1
Note!
If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.
IPv6 address to be configured to the device
Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below
#define DEVICE_IP6 "2001:db8:0:1::121"
IP address of the gateway.
Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below
#define GATEWAY6 "2001:db8:0:1::121"
HTTP_SERVER_IP_ADDRESS refers IP address of the HTTP/HTTPS server
#define HTTP_SERVER_IP_ADDRESS "2001:0db8:0000:0001:0000:0000:0000:0121"
4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.#
#define CONCURRENT_MODE RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP \
(TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_EXTENSION_VALID \
| TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6 | TCP_IP_FEAT_HTTP_CLIENT)
#define RSI_BAND RSI_BAND_2P4GHZ
5. Testing the Application#
User has to follow the below steps for the successful execution of the application.
5.1 Loading the RS9116W Firmware#
Refer Getting started with a PC to load the firmware into RS9116W EVK. The firmware file is located in <SDK>/firmware/
5.2 Building the Application on Host Platform#
5.2.1 Using STM32#
Refer Getting started with STM32
Open the project
<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-nucleo-f411re.uvprojx
Build and Debug the project
Check for the RESET pin:
If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.
If RESET pin is not connected from STM32 to RS9116 , then user need to press the RESET button on RS9116W EVK before free run.
Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
Free run the project
Then continue the common steps from 5.3
5.2.2 Using EFX32#
Refer Getting started with EFX32, for settin-up EFR & EFM host platforms
Open Simplicity Studio and import the EFR32/EFM32 project from
<SDK>/examples/snippets/wlan/http_client_v6/projects
Select the appropriate .slsproj as per Radio Board type mentioned in Section 3.3 for EFR32 board. (or)
Select the *.brd2204a-gg11.slsproj for EFM32GG11 board.
Compile and flash the project in to Host MCU
Debug the project
Check for the RESET pin:
If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run
If RESET pin is not connected from EFX32 to Rs9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
Free run the project
Then continue the common steps from 5.3
5.3 Common Steps#
In Windows PC, install python and run HTTP server.
In release package python scripts are provided to open HTTP server in the path: utilities/script
Run simple_http_server_v6.py by port number 80 as argument to open HTTP server.
After the program gets executed, the device connects to AP and get IP.
After successful connection with Access Point, the Silicon Labs device request for HTTP PUT to PUT/Create the file on to the server, which is given in index.txt file and wait until put file complete.
Remote web server accepts a PUT request and writes the received data to a file. User can find the created new file "index.html" on Windows PC in the following path, utilities/scripts
After successful creation of file using HTTP PUT, Silicon Labs device request for the file "index.html" using HTTP GET method and wait until complete response receive from Server.
After receiving complete response for the given HTTP GET, the device post the given data in HTTP_DATA macro to HTTP server using HTTP POST method.
User can see the log messages at HTTP server.
Compressed Debug Logging#
To enable the compressed debug logging feature please refer to Logging User Guide