---
title: "w5500-rs (mqtt, tls)"
url: "https://maker.wiznet.io/eric_g/projects/w5500-rs-mqtt%2C-tls/"
markdown_url: "https://maker.wiznet.io/eric_g/projects/w5500-rs-mqtt%2C-tls/md"
type: "UCC: User Created Content"
author: "Alex Martens"
author_url: "https://github.com/newAM/w5500-rs"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Alex Martens"
original_url: "https://github.com/newAM/w5500-rs"
published: "2022-08-31"
language: "en"
hardware: ["WIZnet W5500"]
likes: 4
views: 1991
comments: 2
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# w5500-rs (mqtt, tls)

> Embedded rust support for the Wiznet W5500 SPI internet offload chip

Original author: Alex Martens (source: https://github.com/newAM/w5500-rs)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))
- Software: **MQTT**

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

## **w5500-mqtt**

MQTT v5 client for the [Wiznet W5500](https://www.wiznet.io/product-item/w5500/) SPI internet offload chip.

## **Limitations**

This is very basic at the moment, and will be expanded in the future.

- Does not support password protected MQTT servers.

- Only supports QoS 0: At most once delivery.

## **Example**

```
use w5500_mqtt::{
    ll::{
        net::{Ipv4Addr, SocketAddrV4},
        Sn,
    },
    Client, ClientId, Event, DST_PORT, SRC_PORT,
};

let mut client: Client = Client::new(
    Sn::Sn2,
    SRC_PORT,
    SocketAddrV4::new(Ipv4Addr::new(192, 168, 5, 6), DST_PORT),
);

// wait for a connection or die trying
while !matches!(client.process(&mut w5500, monotonic_secs())?, Event::None) {}

// publish to "duck" with a payload "quack"
client.publish(&mut w5500, "duck", b"quack")?;

// subscribe to "cow"
client.subscribe(&mut w5500, "cow")?;
```

## **Relevant Specifications**

- [MQTT Version 5.0](https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html)

## **Feature Flags**

All features are disabled by default.

- `eh0`: Passthrough to [w5500-hl](https://crates.io/crates/w5500-hl).

- `eh1`: Passthrough to [w5500-hl](https://crates.io/crates/w5500-hl).

- `std`: Passthrough to [w5500-hl](https://crates.io/crates/w5500-hl).

- `defmt`: Enable logging with `defmt`. Also a passthrough to [w5500-hl](https://crates.io/crates/w5500-hl).

- `log`: Enable logging with `log`.

- `w5500-tls`: Enable MQTT over TLS.

- `p256-cm4`: Passthrough to [w5500-tls](https://crates.io/crates/w5500-tls).

---

Source: https://maker.wiznet.io/eric_g/projects/w5500-rs-mqtt%2C-tls/
