ioNIC HTTP Client C Example
The W55RP20-S2E is configured as an HTTP client via UART or SPI, enabling it to send GET requests to an HTTP server and receive responses.
How to HTTP Client Example
This example demonstrates how the Raspberry Pi Pico transmits AT commands to the W55RP20 S2E board via UART or SPI to configure it as a HTTP Client(TCP Client) device.
The Raspberry Pi Pico sends an HTTP GET command to the W55RP20 S2E board via UART or SPI, and when the board receives a response from the PC’s HTTP server, it retransmits the response back to the Raspberry Pi Pico through UART or SPI.
Step 1: Prepare software
The following serial terminal programs are required for test, download and install from below links.
Step 2: Prepare hardware
1. Connect GPIO13 according to the selected UART/SPI mode of the W55RP20 EVB Pico, as illustrated below.
| GPIO13 Pin | Desc |
| LOW(GND) | UART mode (default) |
| HIGH(3.3V) | SPI mode |
2. Connect the Raspberry Pi Pico and the W55RP20 EVB Pico using jumper wires as shown below, depending on the selected UART/SPI mode.
If UART mode :
| Raspberry Pi Pico | W55RP20 EVB Pico |
| GPIO4 (UART_TX) | GPIO5 (UART_RX) |
| GPIO5 (UART_RX) | GPIO4 (UART_TX) |
| GND | GND |
If SPI mode :
| Raspberry Pi Pico | W55RP20 EVB Pico |
| GPIO2 (SPI_CLK) | GPIO2 (SPI_CLK) |
| GPIO3 (SPI_TX) | GPIO4 (SPI_RX) |
| GPIO4 (SPI_RX) | GPIO3 (SPI_TX) |
| GPIO5 (SPI_CS) | GPIO5 (SPI_CS) |
| GPIO26 (SPI_INT) | GPIO26 (SPI_INT) |
| GND | GND |
3. Connect the Raspberry Pi Pico to your PC (desktop or laptop) using a 5-pin Micro USB cable.
4. Connect the W55RP20 EVB Pico to your PC (desktop or laptop) using a USB Type-C cable.
Step 3: Setup HTTP Client Example
Raspberry Pi Pico
Please refer to the link below for setting up the Raspberry Pi Pico development environment.
Getting started with Raspberry Pi Pico
We recommend the following versions for successful build and development:
- pico-sdk:
2.2.0 - ARM GCC Toolchain:
14.2.Rel1
To test the HTTP Client example, minor settings shall be done in code.
Setup network configuration such as IP and Port etc... in 'http_client_uart/spi.c' in 'http/client/' directory.
// http_client_uart.c
printf("\n--- Config W55RP20 with AT command(UART) ---\n");
{
enter_command_mode(); // Send +++ command
factory_reset(); // Send Factory Reset command
// If you send Reset or Factory Reset command, W55RP20 will reboot and enter to default gateway mode
enter_command_mode(); // Send +++ command
at_set("OP", "0"); // Set W55RP20 TCP client mode
at_set("LI", "192.168.11.2"); // Set W55RP20's Local IP : 192.168.11.2
at_set("SM", "255.255.255.0"); // Set W55RP20's Subnet mask : 255.255.255.0
at_set("GW", "192.168.11.1"); // Set W55RP20's Gateway : 192.168.11.1
at_set("DS", "8.8.8.8"); // Set W55RP20's DNS Address : 8.8.8.8
at_set("LP", "5000"); // Set W55RP20's Local Port : 5000
at_set("RH", "192.168.11.100"); // Set Remote IP(ex. PC) : 192.168.11.100
at_set("RP", "8080"); // Set Remote Port(HTTP) : 8080
at_set("SV", NULL); // Send Save command
sleep_ms(100);
device_reset(); // Send Reset command
uart_rx_flush();
} // http_client_spi.c
printf("\n--- Config W55RP20 with AT command(SPI) ---\n");
{
at_set("FR", NULL); // Send Factory Reset command
printf("W55RP20 is Rebooting...\n");
sleep_ms(3000);
at_set("OP", "0"); // Set W55RP20 TCP client mode
at_set("LI", "192.168.11.2"); // Set W55RP20's Local IP : 192.168.11.2
at_set("SM", "255.255.255.0"); // Set W55RP20's Subnet mask : 255.255.255.0
at_set("GW", "192.168.11.1"); // Set W55RP20's Gateway : 192.168.11.1
at_set("DS", "8.8.8.8"); // Set W55RP20's DNS Address : 8.8.8.8
at_set("LP", "5000"); // Set W55RP20's Local Port : 5000
at_set("RH", "192.168.11.100"); // Set Remote IP(ex. PC) : 192.168.11.100
at_set("RP", "8080"); // Set Remote Port(HTTP) : 8080
at_set("SV", NULL); // Send Save command
at_set("RT", NULL); // Send Reset command
printf("W55RP20 is Rebooting...\n");
sleep_ms(3000);
spi_rx_pending = false;
}
W55RP20 EVB Pico
Please refer to the link below for instructions on how to use the W55RP20 S2E.
Getting started with W55RP20 EVB Pico
PC(HTTP Server)
To test the HTTP Client example, you need to run an HTTP server on your PC.
Enter the following commands in a terminal window to start the HTTP server.
## Windows cmd.exe
> mkdir http_test_dir
> cd http_test_dir
> echo Hello W55RP20-S2E> index.html # make html file for test
> npm install -g http-server # install http server
> http-server . -p 8080 # run http serverStep 4: Build and Download
Raspberry Pi Pico
To build the project in Visual Studio Code, select one of the three methods below:
1. Click Build in the bottom status bar
2. Press F7 on your keyboard
3. Run the following command in the Visual Studio Code terminal
$ mkdir build
$ cd ./build
$ cmake -G "NMake Makefiles" ..
$ nmakeWhen the build is completed, the '{example_name}_uart.uf2' file is generated for UART mode, and the '{example_name}_spi.uf2' file is generated for SPI mode in the {Repository}/build/loopback/ directory. Download the UF2 file to the Raspberry Pi Pico.
W55RP20 EVB Pico
Following Step 3 in the Getting Started Guide, program the W55RP20 EVB Pico with the UF2 file and write the MAC address to complete the setup.
Step 5: Run
Connect to the serial COM port of the Raspberry Pi Pico using Tera Term.
Step 5.1: UART mode
1. Configuring the W55RP20 S2E as a HTTP Client(TCP Client) and Setting Up the Network with AT command.
2. The Raspberry Pi Pico sends an HTTP GET request message to the W55RP20 S2E via the UART interface.
The W55RP20 S2E forwards the data received over UART directly to Ethernet.
The PC (HTTP Server) receives the GET request and sends the response back to the W55RP20 S2E over Ethernet.
The W55RP20 S2E then forwards the HTTP response data received over Ethernet directly to the Raspberry Pi Pico via UART.
Step 5.2: SPI mode
1. Configuring the W55RP20 S2E as a HTTP Client(TCP Client) and Setting Up the Network with AT command.
2. The Raspberry Pi Pico sends an HTTP GET request message to the W55RP20 S2E via the SPI interface.
The W55RP20 S2E forwards the data received over SPI directly to Ethernet.
The PC (HTTP Server) receives the GET request and sends the response back to the W55RP20 S2E over Ethernet.
The W55RP20 S2E then forwards the HTTP response data received over Ethernet directly to the Raspberry Pi Pico via SPI.

