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.
0
Components
Hardware componentsSoftware Apps and online services
Project description
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
- Clone https://github.com/cesanta/mongoose
- Open examples/arduino/w5500-http in Arduino IDE
- Select Raspberry Pi Pico as board
- In mongoose_custom.h add: #define MG_ENABLE_MBEDTLS 1
- Build & upload
- 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:
// mongoose_custom.h
#define MG_ENABLE_MBEDTLS 1 // enable TLS
#define MG_TLS MG_TLS_MBEDTLS // use mbedTLS backendApplications and Extensions
- Secure sensor dashboards
- Remote firmware updates over HTTPS
- MQTT over TLS on very low-cost boards
- Industrial devices that need encryption with < 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



