To test the ethernet examples, the development environment must be configured to use Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2.
These examples were tested after configuring the development environment on Windows. Please refer to 'Chapter 3: Installing the Raspberry Pi Pico VS Code Extension' in the document below and configure accordingly.
Visual Studio Code was used during development and testing of ethernet examples, the guide document in each directory was prepared also base on development with Visual Studio Code. Please refer to corresponding document.
The ethernet examples use Raspberry Pi Pico and WIZnet Ethernet HAT - ethernet I/O module built on WIZnet's W5100S ethernet chip, W5100S-EVB-Pico - ethernet I/O module built on RP2040 and WIZnet's W5100S ethernet chip, W5500-EVB-Pico and W55RP20-EVB-Pico - ethernet I/O module built on RP2040 and WIZnet's W5500 ethernet chip, W5100S-EVB-Pico2 - ethernet I/O module built on RP2350 and WIZnet's W5100S ethernet chip or W5100S-EVB-Pico2 - ethernet I/O module built on RP2350 and WIZnet's W5100S ethernet chip.
- Raspberry Pi Pico & WIZnet Ethernet HAT
- W5100S-EVB-Pico
- W5500-EVB-Pico
- W55RP20-EVB-Pico
- W5100S-EVB-Pico2
- W5500-EVB-Pico2
- Download
If the ethernet examples are cloned, the library set as a submodule is an empty directory. Therefore, if you want to download the library set as a submodule together, clone the ethernet examples with the following Git command.
/* Change directory */
// change to the directory to clone
cd [user path]
// e.g.
cd D:/WIZnet-PICO
/* Clone */
git clone --recurse-submodules https://github.com/Wiznet/WIZnet-PICO-SNMP-C.git
With Visual Studio Code, the library set as a submodule is automatically downloaded, so it doesn't matter whether the library set as a submodule is an empty directory or not, so refer to it.
- Setup board
Setup the board in 'CMakeLists.txt' in 'WIZnet-PICO-C/' directory according to the evaluation board to be used referring to the following.
- WIZnet Ethernet HAT
- W5100S-EVB-Pico
- W5500-EVB-Pico
- W55RP20-EVB-Pico
- W5100S-EVB-Pico2
- W5500-EVB-Pico2
For example, when using WIZnet Ethernet HAT :
# Set board
set(BOARD_NAME WIZnet_Ethernet_HAT)
When using W55RP20-EVB-Pico :
# Set board
set(BOARD_NAME W55RP20_EVB_PICO)
- Test
Please refer to 'README.md' in each example directory to find detail guide for testing ethernet examples.
※ If the board pauses when rebooting using W55RP20-EVB-Pico, patch it as follows.
// Patch git apply ./patches/0001_pico_sdk_clocks.patch
If you are using W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2, you can skip '1. Combine...'
-
Combine WIZnet Ethernet HAT with Raspberry Pi Pico.
-
Connect ethernet cable to WIZnet Ethernet HAT, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2 ethernet port.
-
Connect Raspberry Pi Pico, W5100S-EVB-Pico or W5500-EVB-Pico to desktop or laptop using 5 pin micro USB cable. W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2 require a USB Type-C cable.
To test the SNMP example, minor settings shall be done in code.
- Setup SPI port and pin in 'w5x00_spi.h' in 'WIZnet-PICO-SNMP-C/port/ioLibrary_Driver/' directory.
Setup the SPI interface you use.
- If you use the W5100S-EVB-Pico, W5500-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2,
/* SPI */
#define SPI_PORT spi0
#define PIN_SCK 18
#define PIN_MOSI 19
#define PIN_MISO 16
#define PIN_CS 17
#define PIN_RST 20
If you want to test with the SNMP example using SPI DMA, uncomment USE_SPI_DMA.
/* Use SPI DMA */
//#define USE_SPI_DMA // if you want to use SPI DMA, uncomment.
- If you use the W55RP20-EVB-Pico,
/* SPI */
#define USE_SPI_PIO
#define PIN_SCK 21
#define PIN_MOSI 23
#define PIN_MISO 22
#define PIN_CS 20
#define PIN_RST 25
- Setup network configuration such as IP in 'w5x00_snmp.c' which is the SNMP example in 'WIZnet-PICO-SNMP-C/examples/snmp/' directory.
Setup IP and other network settings to suit your network environment.
/* Network */
static wiz_NetInfo g_net_info =
{
.mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
.ip = {192, 168, 11, 2}, // IP address
.sn = {255, 255, 255, 0}, // Subnet Mask
.gw = {192, 168, 11, 1}, // Gateway
.dns = {8, 8, 8, 8}, // DNS server
.dhcp = NETINFO_STATIC // DHCP enable/disable
};
- Setup SNMP configuration in 'w5x00_snmp.c' in 'WIZnet-PICO-SNMP-C/examples/snmp/' directory.
/* SNMP */
uint8_t manager[4] = {192, 168, 11, 162}; // manager ip, (is your pc ip or others managers)
-
After completing the SNMP example configuration, click 'build' in the status bar at the bottom of Visual Studio Code or press the 'F7' button on the keyboard to build.
-
When the build is completed, 'w5x00_snmp.uf2' is generated in 'WIZnet-PICO-SNMP-C/build/examples/snmp/' directory.
- While pressing the BOOTSEL button of Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2 power on the board, the USB mass storage 'RPI-RP2' is automatically mounted.
-
Drag and drop 'w5x00_snmp.uf2' onto the USB mass storage device 'RPI-RP2'.
-
Connect to the serial COM port of Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2 with Tera Term.
-
Reset your board.
-
If the SNMP example works normally on Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2, you can see the network information of Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2 or W5500-EVB-Pico2 and the SNMP is open.
- Enter a command at the terminal to control the User LED on and off. If there is an error in sending the command, it is likely that Net-SNMP is not installed or the command is wrong.