Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists