---
title: "RP2040 FreeRTOS COAP"
url: "https://maker.wiznet.io/Aimee0/projects/rp2040-freertos-coap/"
markdown_url: "https://maker.wiznet.io/Aimee0/projects/rp2040-freertos-coap/md"
type: "WCC: WIZnet Created Content"
author: "Aimee"
author_url: "https://maker.wiznet.io/Aimee0/"
original_author: "aimee"
published: "2024-05-27"
language: "en"
hardware: ["WIZnet W5500"]
likes: 0
views: 1228
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# RP2040 FreeRTOS COAP

> This project is about COAP library in RP2040-HAT-FREERTOS-C.

Original author: aimee

## Components

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

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/))

## Documents and links

- [RP2040-HAT-FREERTOS-COAP_C](https://github.com/aimee0000/RP2040-HAT-FREERTOS-COAP_C) (code)

## Article

### 1.Project

Integrate microcoap library to RP2040-HAT-FREERTOS-C project.

link : https://github.com/1248/microcoap

### 2.Microcoap

Microcoap is a lightweight CoAP library designed to provide basic CoAP functionality in resource-constrained environments.

#### Standard Library vs Lightweight Library

Standard Coap library

- Ex) libcoap, coap.net etc...

- Advantage
  - Rich features: Provides advanced features such as block transfer, observation, and security (DTLS).
  - Scalability: Suitable for complex applications requiring a wide range of CoAP functions.

- Weakness
  - Resource Requirements: Consume more memory and CPU resources, which can be inefficient in limited resource environments such as RP2040.

Lightweight Coap Library

- Ex) microcoap, nanocoap, smcp etc...

- Advantage
  - Lightweight: Very low memory and CPU usage.
  - Simple integration: Small and simple code base for quick and easy integration.

- Weakness
  - Limited features: Basic CoAP message processing only. No advanced features (block transfer, security, etc.).

### 3.Example Code

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716808902%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716808944%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716818869%2Epng)

### 4.How to use

**Download libcoap**

lilnk : <https://github.com/obgm/libcoap>

```plaintext
$ cmake -E remove_directory build
$ cmake -E make_directory build
$ cd build
$ cmake .. -DENABLE_DOCS=OFF -DDTLS_BACKEND=openssl
$ cmake --build .
$ cd Debug
```

**Load program to Pico Board**

Temperature

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716818915%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716818930%2Epng)

Light on

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716818947%2Epng)

Light off

![](https://maker.wiznet.io/upload/ckeditor5/471957466%5F1716818950%2Epng)

---

Source: https://maker.wiznet.io/Aimee0/projects/rp2040-freertos-coap/
