Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Sending large datagrams in FreeRTOS+TCP

Posted by jtbr on June 14, 2017

I have large datagrams I'd like to send over UDP, and in investigating why they weren't being sent I realized that FREERTOS_sendto() caps the size of datagrams at the payload size for a single packet.

It should be possible to allow fragmentation at the IP leve,l for reassembly at the destination. I saw this config option ipconfigCANFRAGMENTOUTGOING_PACKETS that seems to allow exactly what I need. But it appears not to be implemented in +TCP.

Is there any plan to include this functionality in +TCP?

As an alternative, I considered increasing the MTU, but it would be memory-prohibitive as I need to send datagrams up to 24Kb, and I'm also not sure about the hardware level support for that. So now I'm considering if I need to implement a fragmentation and reassembly as a part of my own protocol, but that would be somewhat unfortunate.

Thanks for any help.

Sending large datagrams in FreeRTOS+TCP

Posted by heinbali01 on June 14, 2017

Hi Justin,

In the earlier FreeRTOS+UDP stack there was indeed an option ipconfigCAN_FRAGMENT_OUTGOING_PACKETS. That stack is still distributed along with the kernel, e.g. :

~~~ FreeRTOSv9.0.0/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP ~~~

As the option says, it will only work for outgoing packets, which is enough for you.

When developing +TCP, it was decided to stop supporting UDP packet fragmentation. That decision saved a lot of code and it made the code easier to read.

And in fact, TCP can do exactly what you need: split up and join packets in a reliable way.

You can set MTU to 1500, or a little bit longer in case your peripheral, switches and router support jumbo packets.

So you can use TCP, or, alternatively, give your UDP packets a small header and make your own fragmentation. That should not be too difficult :-)

Sending large datagrams in FreeRTOS+TCP

Posted by jtbr on June 14, 2017

Thanks for the info. I must say you have succeeded in making +TCP very readable.

The nice thing about UDP is that I can broadcast datagrams and listeners can listen as they want or are able. But since I also need and use TCP for more connection-oriented comms, using just +UDP isn't an option.

I'll look into breaking up and reassembling UDP at the application level then.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.


FreeRTOS and other embedded software careers at AWS.

Latest News

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner