---
title: "Mongoose library RP2040-W5500 example"
url: "https://maker.wiznet.io/viktor/projects/mongoose-library-rp2040-w5500-example/"
markdown_url: "https://maker.wiznet.io/viktor/projects/mongoose-library-rp2040-w5500-example/md"
type: "UCC: User Created Content"
author: "Cesanta Software"
author_url: "https://github.com/cesanta/mongoose/tree/master/examples/rp2040/pico-w5500"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Cesanta Software"
original_url: "https://github.com/cesanta/mongoose/tree/master/examples/rp2040/pico-w5500"
published: "2023-01-03"
language: "en"
hardware: ["WIZnet W5500", "Raspberry Pi RP2040"]
likes: 6
views: 6093
comments: 2
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Mongoose library RP2040-W5500 example

> Mongoose library RP2040-W5500 example

Original author: Cesanta Software (source: https://github.com/cesanta/mongoose/tree/master/examples/rp2040/pico-w5500)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))
- **Raspberry Pi RP2040** x 1 ([docs](https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

## RP2040 with W5500 Ethernet module

This repository demonstrates how to use RP2040 with W5500 Ethernet module, to implement networking. In this example, a very simple HTTP server is implemented. See [other examples](https://github.com/cesanta/mongoose/blob/master/examples) for more functionality.

## RP2040 Pico wiring

The W5500 module uses SPI for communication. The following pins are used by this example (modify `main.c` if you use a different pinout):

```
enum { LED = 25, SPI_CS = 17, SPI_CLK = 18, SPI_TX = 19, SPI_RX = 16 };
```

On a breadboard, it might look like this:

[![](https://github.com/cesanta/mongoose/raw/master/examples/rp2040/pico-w5500/images/wiring.png)](https://github.com/cesanta/mongoose/blob/master/examples/rp2040/pico-w5500/images/wiring.png)

## Pinout reference

[![](https://github.com/cesanta/mongoose/raw/master/examples/rp2040/pico-w5500/images/pinout.png)](https://github.com/cesanta/mongoose/blob/master/examples/rp2040/pico-w5500/images/pinout.png)

## Build and run

Clone Mongoose repo, go to this example, and build it:

```
git clone https://github.com/cesanta/mongoose
cd mongoose/examples/ro2040/pico-w5500
make
```

The above will make a firmware in `build/example.uf2`. Reboot your Pico board in bootloader mode, and copy `example.uf2` to the RPI disk.

Attach serial console. Then, plug in Ethernet cable:

```plaintext
$ cu -l /dev/cu.usb* -s 115200
4653 2 main.c:79:main                   Ethernet: down
520b 2 main.c:79:main                   Ethernet: down
5dc3 2 main.c:79:main                   Ethernet: down
6593 1 mongoose.c:6757:onstatechange    Link up
659a 3 mongoose.c:6840:tx_dhcp_discover DHCP discover sent
667b 3 mongoose.c:6723:arp_cache_add    ARP cache: added 192.168.0.1 @ 90:5c:44:55:19:8b
667d 2 mongoose.c:6749:onstatechange    READY, IP: 192.168.0.24
667e 2 mongoose.c:6750:onstatechange           GW: 192.168.0.1
6680 2 mongoose.c:6752:onstatechange           Lease: 86062 sec
697b 2 main.c:79:main                   Ethernet: up
7533 2 main.c:79:main                   Ethernet: up
```

Note the aquired IP address printed. Run a browser, and type that IP address in the address field. You should see an "ok" message in a browser:

[![](https://github.com/cesanta/mongoose/raw/master/examples/rp2040/pico-w5500/images/browser.png)](https://github.com/cesanta/mongoose/blob/master/examples/rp2040/pico-w5500/images/browser.png)

---

Source: https://maker.wiznet.io/viktor/projects/mongoose-library-rp2040-w5500-example/
