# Wireless FreeRTOS IP stack

**URL:** <https://forums.freertos.org/t/wireless-freertos-ip-stack/17251>\
**Category:** Libraries\
**Created:** [April 19, 2023, 8:01am UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251 "2023-04-19T08:01:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![EduardoGoncalves1966](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/eduardogoncalves1966/32/1686_2.png) [@EduardoGoncalves1966](https://forums.freertos.org/u/EduardoGoncalves1966)\
**Post date:** [April 19, 2023, 8:01am UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/1 "2023-04-19T08:01:13Z")

</div>

Hi

I would like to know if there is an implementation of the FreeRTOS IP stack running on a Wireless interface.  
I am looking for an alternative to the ESP32 running lwIP stack on its wireless interface.

Can you tell in which demo board this has been implemented?

thanks,  
Eduardo

---

<div class="post-metadata">

**Author:** ![karahulx](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/karahulx/32/4893_2.png) [@karahulx](https://forums.freertos.org/u/karahulx)\
**Post date:** [April 19, 2023, 5:18pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/2 "2023-04-19T17:18:51Z")

</div>

Hi @EduardoGoncalves1966  
Thanks for reaching out to the FreeRTOS Forum community!

FreeRTOS, by design, uses the vendor specific WiFi APIs directly with a TCP/IP and network transport layer in between.  
FreeRTOS+TCP has a network interface implemented for ESP32 board [here](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/portable/NetworkInterface/esp32/NetworkInterface.c)  
You can use it to replace the default Lwip , ESP IDF currently implements.  
The best place to look at for these will be the ESP IDF at [GitHub - espressif/esp-aws-iot: AWS IoT SDK for ESP32 based chipsets](https://github.com/espressif/esp-aws-iot). This has some good examples which can be referred in the folder “examples”.  
Apart from ESP32, FreeRTOS+TCP has also been implemented on the wireless interface in the Pic32 board  
[FreeRTOS-Plus-TCP/NetworkInterface\_wifi.c at main · FreeRTOS/FreeRTOS-Plus-TCP · GitHub](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/portable/NetworkInterface/pic32mzef/NetworkInterface_wifi.c)

---

<div class="post-metadata">

**Author:** ![EduardoGoncalves1966](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/eduardogoncalves1966/32/1686_2.png) [@EduardoGoncalves1966](https://forums.freertos.org/u/EduardoGoncalves1966)\
**Post date:** [April 20, 2023, 1:45pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/3 "2023-04-20T13:45:02Z")

</div>

Hi  
Thanks for the fast answer and the links.

I am more interested in implementing an Application that will communicate using UDP broadcasts (without Access Points. Just like if it was running on Ethernet). And also creating a TCP connection to communicate between 2 systems.

Is there a simple project for this? I inspected the directory and it seems there are implementations for complex protocols like MQTT, HTTP, etc.

I am looking for something as simple as possible that allows to use TCP connections and UDP broadcasts.

thanks

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [April 20, 2023, 3:34pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/4 "2023-04-20T15:34:09Z")

</div>

Did you look at this one - [FreeRTOS/FreeRTOS-Plus/Demo/FreeRTOS\_Plus\_TCP\_Minimal\_Windows\_Simulator/DemoTasks at main · FreeRTOS/FreeRTOS · GitHub](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks)

---

<div class="post-metadata">

**Author:** ![EduardoGoncalves1966](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/eduardogoncalves1966/32/1686_2.png) [@EduardoGoncalves1966](https://forums.freertos.org/u/EduardoGoncalves1966)\
**Post date:** [April 21, 2023, 8:35am UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/5 "2023-04-21T08:35:44Z")

</div>

Hi

Does that example run on a WiFi interface?

One thing that I don’t understand is on hopw to choose the interface that the TCP/IP stack should use:

xListeningSocket = FreeRTOS\_socket( FREERTOS\_AF\_INET, FREERTOS\_SOCK\_STREAM, FREERTOS\_IPPROTO\_TCP );

When a socket is created how does one associate this stream with Ethernet or WiFi?

thanks

---

<div class="post-metadata">

**Author:** ![ActoryOu](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/actoryou/32/2880_2.png) [@ActoryOu](https://forums.freertos.org/u/ActoryOu)\
**Post date:** [April 24, 2023, 2:29am UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/6 "2023-04-24T02:29:29Z")

</div>

Hi @EduardoGoncalves1966,  
It depends on what port you’re using for the platform.  
Take [esp32](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/portable/NetworkInterface/esp32/NetworkInterface.c#L86) as example, the `xNetworkInterfaceOutput` is the interface for FreeRTOS-Plus-TCP to transmit output packet through the network interface. And `esp_wifi_internal_tx()` is esp32’s wifi API!  
You can also try this [Networking Demo Project](https://www.freertos.org/FreeRTOS-simulator-for-Linux.html). It uses [libpcap as network interface](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/source/portable/NetworkInterface/linux/NetworkInterface.c#L715) on top of Linux, support on any available network interfaces on your machine.

Thanks.

---

<div class="post-metadata">

**Author:** ![EduardoGoncalves1966](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/eduardogoncalves1966/32/1686_2.png) [@EduardoGoncalves1966](https://forums.freertos.org/u/EduardoGoncalves1966)\
**Post date:** [April 25, 2023, 2:49pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/7 "2023-04-25T14:49:16Z")

</div>

Thanks for the answers.

Although I am looking for an example project where a TCP connection is being made between two ESP32 boards, ideally ESP32-WROOM.  
Also a UDP broadcast example would be nice but I think when I have a the TCP project I can make this one.

Any help? Thanks.

---

<div class="post-metadata">

**Author:** ![Shub](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@Shub](https://forums.freertos.org/u/Shub)\
**Post date:** [May 2, 2023, 6:35pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/9 "2023-05-02T18:35:25Z")

</div>

You can refer to the demo [FreeRTOS/FreeRTOS-Plus/Demo/FreeRTOS\_Plus\_TCP\_IPv6\_Demo/IPv6\_Multi\_WinSim\_demo at devIPv6 · FreeRTOS/FreeRTOS · GitHub](https://github.com/FreeRTOS/FreeRTOS/tree/devIPv6/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo). This creates multiple endpoints. For ESP32, you will will have to use the ESP32 portable layer([FreeRTOS-Plus-TCP/source/portable/NetworkInterface/esp32 at main · FreeRTOS/FreeRTOS-Plus-TCP · GitHub](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/main/source/portable/NetworkInterface/esp32)) instead of the libpcap portable layer.

---

<div class="post-metadata">

**Author:** ![esr](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@esr](https://forums.freertos.org/u/esr)\
**Post date:** [February 6, 2025, 8:46pm UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/10 "2025-02-06T20:46:22Z")

</div>

Can someone help setting up an example?  
i am struggling with idf and cmake. So it is maybe more a esp-idf question,…

I started a normal idf project and freertos-plus-tcpip is a submodule

```cmake
set(FREERTOS_PLUS_TCP_NETWORK_IF "ESP32")
add_subdirectory(../submodules/FreeRTOS-Plus-TCP freertos_plus_tcp)

```

lines in the main/CMakeLists.txt

dependencies needed:

```cmake
freertos_plus_tcp need

target_link_libraries( freertos_plus_tcp
  PUBLIC
    freertos_config
    freertos_plus_tcp_port # for pack_struct_start.h
  PRIVATE
    freertos_kernel
    freertos_plus_tcp_network_if
    freertos_plus_tcp_utilities
)

```

and ESP32 networkdriver

```cmake
target_link_libraries( freertos_plus_tcp_network_if
  PRIVATE
    esp32_lib
)

```

At idf [idf BuildSystem](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html#using-third-party-cmake-projects-with-components) there are some info how to achieve what i need but i cannot set up a working example.

Do i have to follow the idf component way or go the plain cmake way with idf as library?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [February 7, 2025, 9:13am UTC](https://forums.freertos.org/t/wireless-freertos-ip-stack/17251/11 "2025-02-07T09:13:12Z")

</div>

> [@esr](#):
>
> Do i have to follow the idf component way or go the plain cmake way with idf as library?

I think using the IDF component way would be easier but I’d suggest to reach out to Espressif and confirm with them.
