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


+TCP issue when configTICK_RATE_HZ is not equal to 1000 Hz

Posted by heinbali01 on February 26, 2016

Hello list,

Thanks to one of the users of FreeRTOS+TCP, Tamas Selmeci, we discovered an issue: a TCP connection may die as soon as a transmitted packet gets dropped (never arrives).

This can only happen when configTICK_RATE_HZ is defined as less than 1000 Hz.

Proposed change for now:

~~~~ Within 'FreeRTOSTCPIP.c' :


In 'FreeRTOS_IP.h' please add this macro :

    #define pdMS_TO_MIN_TICKS( xTimeInMs )\
        ( pdMS_TO_TICKS( ( xTimeInMs ) ) < 1 ? 1 : pdMS_TO_TICKS( ( xTimeInMs ) ) )


The problem occurs when pdMS_TO_TICKS() returns zero. When pxSocket->u.xTcp.usTimeout becomes zero it means: this socket does not need attention from the IP-task. As a result, the connection would die.

Changing subject:

FreeRTOS+TCP will soon support multiple interfaces and IP-addresses! If anyone would like to pioneer and help us with testing, pleas write to us directly ( e.g. to h.tibosch located at freertos.org ). We'd love to get feedback from you before releasing the new source code.


+TCP issue when configTICK_RATE_HZ is not equal to 1000 Hz

Posted by richard_damon on February 26, 2016

Perhaps this issue is similar to what I just commented on in discussing pdMSTOTICKS. Many applications really want to specify a true minimum delay, pdMSTOTICKS does not do this. You likely want the calculation to round up not down in computing the number of ticks (so if a floating point calc of the delay was .1 ticks, you would delay a tick) and likely also add 1 to the number to tick to account for the tick interrupt possibly happening immediately after the call.

Note that a timeout of 1 tick has a chance of being 0 time. The smallest time that makes sure that some real time passes is 2 ticks.

+TCP issue when configTICK_RATE_HZ is not equal to 1000 Hz

Posted by heinbali01 on February 26, 2016

Only that in this case a minimum of 1 clock tick would be OK. Even if this results in a sleep of less than 1 uS.

[ 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