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


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