Skip to content

WIZnet-ioNIC/WIZnet-PICO-PING-C

Repository files navigation

WIZnet-PICO-PING-C

  1. 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-PING-C

/* Clone */
git clone --recurse-submodules https://github.com/WIZnet-ioNIC/WIZnet-PICO-PING-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.

  1. Setup board

Setup the board in 'CMakeLists.txt' in 'WIZnet-PICO-PING-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)

How to Test Ping Example

Step 1: Prepare hardware

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...'

  1. Combine WIZnet Ethernet HAT with Raspberry Pi Pico.

  2. 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.

  3. 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.

Step 2: Setup Ping Example

To test the ping example, minor settings shall be done in code.

  1. Setup SPI port and pin in 'w5x00_spi.h' in 'WIZnet-PICO-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 ping 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
  1. Setup network configuration such as IP in 'ping_client.c' which is the ping example in 'WIZnet-PICO-PING-C/examples/ping_client/' directory.

Setup IP and other network settings to suit your network environment.

/* Network */
static wiz_NetInfo 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
};
  1. Setup ping configuration in 'ping_client.c' in 'WIZnet-PICO-PING-C/examples/ping_client/' directory.
static uint8_t remote_ip[4] = {192, 168, 11, 230};    // The IP to be ping

Step 3: Build

  1. After completing the ping 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.

  2. When the build is completed, 'ping_client.uf2' is generated in 'WIZnet-PICO-PING-C/build/examples/ping_client/' directory.

Step 4: Upload and Run

  1. 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.

  2. Drag and drop 'ping_client.uf2' onto the USB mass storage device 'RPI-RP2'.

  3. 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.

  1. Reset your board.

  2. If the ping_client example works correctly on Raspberry Pi Pico, W5100S-EVB-Pico, W5500-EVB-Pico, W55RP20-EVB-Pico, W5100S-EVB-Pico2, or W5500-EVB-Pico2, you will be able to check the network information of the respective board and see the ping success message.

  1. If there is a problem with the network or the connection is not established, an error message such as timeout will be displayed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published