# Eaxmple project for using MQTT and FreeRTOS+TCP on STM32H573

**URL:** <https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907>\
**Category:** ST\
**Tags:** tutorial, aws-iot-core\
**Created:** [November 19, 2024, 1:27pm UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907 "2024-11-19T13:27:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchilakalapudi](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rchilakalapudi](https://forums.freertos.org/u/rchilakalapudi)\
**Post date:** [November 19, 2024, 1:28pm UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/1 "2024-11-19T13:28:00Z")

</div>

Hi,

Could you please provide any example project using core mqtt + freeRTOS+tcp on STM32H573.

Thanks.

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [November 19, 2024, 2:09pm UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/2 "2024-11-19T14:09:58Z")

</div>

@rchilakalapudi

Here is an unofficial demo for STM32H563ZI NUCLEO board that integrated FreeRTOS+TCP: [GitHub - tony-josi-aws/STM32H563ZI\_FreeRTOS\_TCP\_CLI](https://github.com/tony-josi-aws/STM32H563ZI_FreeRTOS_TCP_CLI)

You can take a look at these simulated MQTT demos to integrate it with the above demo: [coreMQTT Demo (without TLS) - FreeRTOS™](https://www.freertos.org/Documentation/03-Libraries/03-FreeRTOS-core/02-coreMQTT/02-Demos/01-coreMQTT-demo)

---

<div class="post-metadata">

**Author:** ![rchilakalapudi](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rchilakalapudi](https://forums.freertos.org/u/rchilakalapudi)\
**Post date:** [November 20, 2024, 6:08am UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/3 "2024-11-20T06:08:01Z")

</div>

Hi Tony - Josi,  
Thanks for quick reply. I have question related tls part. is freertis+tcp can support TLS? if there please provide the example project.

Thanks.

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [November 20, 2024, 6:36am UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/4 "2024-11-20T06:36:46Z")

</div>

@rchilakalapudi

> is freertis+tcp can support TLS? if there please provide the example project.

yes, we have a simulated demo that uses coreMQTT with TLS (demo uses mbedTLS for TLS part) on top of FreeRTOS+TCP here: [coreMQTT Demo (with TLS Server Authentication) - FreeRTOS™](https://www.freertos.org/Documentation/03-Libraries/03-FreeRTOS-core/02-coreMQTT/02-Demos/02-coreMQTT-demo-LTS)

---

<div class="post-metadata">

**Author:** ![rchilakalapudi](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rchilakalapudi](https://forums.freertos.org/u/rchilakalapudi)\
**Post date:** [November 20, 2024, 6:50am UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/5 "2024-11-20T06:50:11Z")

</div>

Hi tony-josi-aws,

Thank you for your prompt response. I have one more question related to the TCP component: Is it feasible to use only the TCP library in the future if we want to switch to another RTOS? Please provide more details about this, and let me know if there is any documentation available.

Thanks.

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [November 20, 2024, 12:46pm UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/6 "2024-11-20T12:46:46Z")

</div>

Hi @rchilakalapudi

> Is it feasible to use only the TCP library in the future if we want to switch to another RTOS?

FreeRTOS+TCP is designed with FreeRTOS as the supporting RTOS in mind. The task synchronization, memory management, signaling, data types, etc. are tightly coupled with the FreeRTOS “way” of doing it. It could be possible to update it to run on other RTOSes, but it won’t be very straightforward as just mapping APIs.

---

<div class="post-metadata">

**Author:** ![rchilakalapudi](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rchilakalapudi](https://forums.freertos.org/u/rchilakalapudi)\
**Post date:** [November 20, 2024, 1:51pm UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/7 "2024-11-20T13:51:20Z")

</div>

Hi @tony-josi-aws

Thanks for your reply

your comment:  
It could be possible to update it to run on other RTOSes, but it won’t be very straightforward as just mapping APIs.  
Ravi: It means that for users it is very difficult to port to other RTOSes?

1. “We are currently using FreeRTOS in our products and are interested in the FreeRTOS+TCP integration. However, we need a more detailed comparison between lwIP and FreeRTOS+TCP, focusing on their advantages and disadvantages.”
2. expecting comparison between RAM,ROM utilization, speed, application interfaces, network interface, performance etc…
3. “I have seen the zero-copy buffer concept, but it seems more applicable to UDP than TCP. Does it support TCP as well? If so, please provide more details or documentation about this.”

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [November 21, 2024, 4:58am UTC](https://forums.freertos.org/t/eaxmple-project-for-using-mqtt-and-freertos-tcp-on-stm32h573/21907/8 "2024-11-21T04:58:46Z")

</div>

@rchilakalapudi

> 1. “We are currently using FreeRTOS in our products and are interested in the FreeRTOS+TCP integration. However, we need a more detailed comparison between lwIP and FreeRTOS+TCP, focusing on their advantages and disadvantages.” 2. expecting comparison between RAM,ROM utilization, speed, application interfaces, network interface, performance etc…

You can refer to these existing threads for comparison:

1. [Thread 1](https://forums.freertos.org/t/freertos-plus-tcp-vs-freertos-lwip/16910)
2. [Thread 2](https://www.freertos.org/FreeRTOS_Support_Forum_Archive/November_2014/freertos_FreeRTOS_TCP_IP_stack_vs_lwIP_8324ceabj.html)
3. [Thread 3](https://forums.freertos.org/t/exclusive-lwip-freertos-vs-freertos-plus/18978/5)

> 1. “I have seen the zero-copy buffer concept, but it seems more applicable to UDP than TCP. Does it support TCP as well? If so, please provide more details or documentation about this.”

TCP also offers zero copy. As UDP is a packet-oriented protocol with zero copy, you get to write/read directly to the network packet that is transmitted over the network, whereas in the case of TCP with zero copy, you are directly writing/reading from the TCP stream buffers as its a stream-oriented protocol. You can refer to these pages for documentation:

- [Receiving Data Using a TCP Socket (zero copy interface)](https://freertos.org/Documentation/03-Libraries/02-FreeRTOS-plus/02-FreeRTOS-plus-TCP/04-Tutorial/15-Receiving-TCP-data-zero-copy)
- [Sending Data Using a TCP Socket (zero copy interface)](https://www.freertos.org/Documentation/03-Libraries/02-FreeRTOS-plus/02-FreeRTOS-plus-TCP/04-Tutorial/16-Sending-TCP-data-zero-copy)

Also, you can find a TCP zero copy [demo here](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c) [if `USE_TCP_ZERO_COPY` is enabled] that optionally uses zero copy.
