---
title: "Running TLS on a Tiny MCU – RP2040 + W5500 with Only 32 kB RAM & 128 kB Flash"
url: "https://maker.wiznet.io/Benjamin/projects/running-tls-on-a-tiny-mcu--rp2040-w5500-with-only-32-kb-ram-128-kb-flash/"
markdown_url: "https://maker.wiznet.io/Benjamin/projects/running-tls-on-a-tiny-mcu--rp2040-w5500-with-only-32-kb-ram-128-kb-flash/md"
type: "UCC: User Created Content"
author: "Mongoose Networking Library"
author_url: "https://www.youtube.com/watch?v=nEkOexjghyg"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Mongoose Networking Library"
original_url: "https://www.youtube.com/watch?v=nEkOexjghyg"
license: "Apache License 2.0 (Apache-2.0)"
published: "2025-11-19"
language: "en"
tags: ["W5500"]
hardware: ["Raspberry Pi RP2040", "WIZnet W5500"]
likes: 0
views: 963
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Running TLS on a Tiny MCU – RP2040 + W5500 with Only 32 kB RAM & 128 kB Flash

> A clean, real-world test showing that a full HTTPS web server (TLS 1.3) can run on an RP2040 using just 32 kB RAM and 128 kB flash when paired with the W5500.

Original author: Mongoose Networking Library (source: https://www.youtube.com/watch?v=nEkOexjghyg)

## Components

- **Raspberry Pi RP2040** x 1 ([docs](https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html))
- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))
- Software: **Cesanta Software Ltd Mongoose** ([docs](https://mongoose.ws/documentation/))
- Software: **PlatformIO IDE** ([docs](https://platformio.org/install/ide))

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

### Introduction

Let’s start with the question everyone asks: How small can an MCU be and still run proper TLS? The answer is surprisingly small — an RP2040 + W5500 runs full TLS 1.3 with only 32 kB RAM and 128 kB flash.

### WIZnet Product Integration

The W5500 is the star here. It handles the complete TCP/IP stack in hardware, so the RP2040 only communicates over SPI. Almost no RAM or CPU time is spent on networking — perfect for adding TLS on tiny microcontrollers.

### Technical Implementation

Hardware wiring is extremely simple:

- Pico SPI0 → W5500 (CS=GP5, SCK=GP2, MOSI=GP3, MISO=GP4, RST=GP6)

- 3.3 V + GND

Software: just copy mongoose.c and mongoose.h, then enable TLS with one line in mongoose_custom.h.

### Reproduction Guide

1. Clone <https://github.com/cesanta/mongoose>

2. Open examples/arduino/w5500-http in Arduino IDE

3. Select Raspberry Pi Pico as board

4. In mongoose_custom.h add: #define MG_ENABLE_MBEDTLS 1

5. Build & upload

6. Check Serial Monitor for IP → open https://[IP] in browser

You now have a working HTTPS server.

### Core Features and Performance

- Plain HTTP: ≈ 17 kB RAM

- HTTPS (TLS 1.3): ≈ 25 kB RAM (+8 kB for TLS)

- TLS handshake: ~600 ms on 133 MHz Cortex-M0+

- Extra flash for TLS: ≈ 20 kB

- Confirmed minimum: 32 kB RAM / 128 kB flash

### Code Snippet

Only change needed:

```c
// mongoose_custom.h
#define MG_ENABLE_MBEDTLS 1        // enable TLS
#define MG_TLS MG_TLS_MBEDTLS      // use mbedTLS backend
```

### Applications and Extensions

- Secure sensor dashboards

- Remote firmware updates over HTTPS

- MQTT over TLS on very low-cost boards

- Industrial devices that need encryption with &lt; 64 kB RAM (planned: client certificates, PSK mode for even lower RAM)

### Conclusion

If you thought TLS was impossible on small MCUs, this demo proves otherwise. RP2040 + W5500 + Mongoose = production-grade HTTPS server in under 30 kB RAM.

Try it today — everything is ready here: <https://github.com/cesanta/mongoose/tree/master/examples/arduino/w5500-http>

---

Source: https://maker.wiznet.io/Benjamin/projects/running-tls-on-a-tiny-mcu--rp2040-w5500-with-only-32-kb-ram-128-kb-flash/
