Quality RTOS & Embedded Software

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


Found an issue with +TCP

Posted by joehinkle on August 12, 2016

Since I've ported +TCP, I've been chasing several issue (most caused by me and my xNetworkInterfaceOutput().)

With those behind me, I was having an issue with the ENET not transmitting some messages randomly.

I finially figured that the Ethernet buffer being passed via pxNetworkBuffer to the xNetworkInterfaceOutput() function did not meet the 8 byte alignment requirement of the ENET.

When the ENET is asked to transmit a buffer NOT 8 byte aligned it stalls and does nothing.

Tracing into the stacks source code I found the issue.

~~~ static void prvTCPReturnPacket( FreeRTOSSockett *pxSocket, NetworkBufferDescriptort *pxNetworkBuffer, uint32t ulLen, BaseTypet xReleaseAfterSend ) { TCPPackett * pxTCPPacket; IPHeadert *pxIPHeader; EthernetHeadert *pxEthernetHeader; uint32t ulFrontSpace, ulSpace; TCPWindowt *pxTCPWindow; NetworkBufferDescriptor_t xTempBuffer;

/* For sending, a pseudo network buffer will be used, as explained above. */

if( pxNetworkBuffer == NULL )
	pxNetworkBuffer = &xTempBuffer;

	#if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )
		xTempBuffer.pxNextBuffer = NULL;
	xTempBuffer.pucEthernetBuffer = pxSocket->u.xTCP.lastPacket;   ISSUE!!!!!!!
	xTempBuffer.xDataLength = sizeof pxSocket->u.xTCP.lastPacket;
	xReleaseAfterSend = pdFALSE;



lastPacket happens to be an array internal to the socket.

Depending on the memory location that held the socket, lastPacket may or may NOT meet my 8 byte alignment requirement.

It may case - it did not and it causes the ENET to stall.

Let me know if you disagree -- but I've traced this buffer all the way to thexNetworkInterfaceOutput() and it is root-cause.

I am using BufferAllocation_1

I hope this helps.

Not sure how to fix it myself other than to acquire a real NetworkBufferDescriptor_t and copy the contents of lastPacket into it.


Found an issue with +TCP

Posted by joehinkle on August 12, 2016


Hein informed me that setting config flag: ipconfigZEROCOPYTX_DRIVER forces the stack to always use "Real" buffers.

Applied the config variable and all is fine.

Please note: there is absolutely ZERO information posted anywhere on the usage of the flag ipconfigZEROCOPYTX_DRIVER.

Hein has been a great help. All is well.



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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

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