FreeRTOS+TCP with LPC17XX

sm2wmv wrote on Monday, March 21, 2016:

Hello,

Has there been made any port yet to the LPC17XX platform? I intend to use FreeRTOS+TCP with an LPC1769 on an own hardware platform. The LPCopen code does not seem to be maintained much so it would be nice if it was possible to use FreeRTOS+TCP instead.

/Mike

rtel wrote on Monday, March 21, 2016:

You will find an old LPC17xx lwIP demo on the following link, but as you say, the driver standard is out of date too: http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_IO/Demo_Applications/LPCXpresso_LPC1769/NXP_LPC1769_Demo_Description.shtml

There is a driver for the LPC18xx for FreeRTOS+TCP, but it has not been used in a while, and may therefore need a little tinkering to get it to build with the latest +TCP code.

sm2wmv wrote on Tuesday, March 22, 2016:

Where can that driver for the LPC18xx be found?

rtel wrote on Tuesday, March 22, 2016:

I have attached what we have - note while this was working just fine some time ago, as you can see it was never completed, and may need work to use with the latest +TCP code. I hope it will be useful, but that’s all…

heinbali01 wrote on Tuesday, March 22, 2016:

A small correction on what Richard wrote. He attached this file:

FreeRTOS-Plus-TCP/portable/NetworkInterface/LPC18xx/NetworkInterface.c

which is from a very recent date, recently tested on a LPC1830, and compatible with the latest release of FreeRTOS+TCP.
One of the users on this forum is adapting this LPC18xx/NetworkInterface.c to use it on a LPC43xx.

However, if I’m not mistaken, the EMAC of LPC18xx is not compatible with the EMAC of a LPC17xx.

I will attach the LPC17xx version. This version has not been tested for a long time. We only kept the naming of the functions up-to-date, so it should compile. But I guess that you will have some work on it before it runs.
You can always write if you have more questions.

Attachment LPC17xx/NetworkInterface.c:

FreeRTOS-Plus-TCP/portable/NetworkInterface/LPC17xx/NetworkInterface.c

lsegui wrote on Wednesday, May 04, 2016:

Hi Mike,

I pretend to use the same FreeRTOS+TCP with the LPC1769 CMSIS DAP REV. D.
Did you success with making it work with the driver attached by Hein?

vbs2019 wrote on Wednesday, January 02, 2019:

Hello Hein,

Do you have the emac driver that goes with this example of NetworkInterface.c for the LPC17XX?
The example does refer to:

extern void EMAC_StartTransmitNextBuffer( uint32_t ulLength );
extern void EMAC_SetNextPacketToSend( uint8_t * pucBuffer );

Which are not defined by the emac driver provided by NXP. Thus, I assume you had to modify it.

Have you guys evolved this further for the LPC17XX?

vbs2019 wrote on Wednesday, January 02, 2019:

I am trying to bring up the FreeRtos+TCP on an Embedded Arttists EALPC1788 board. Thus, my quesion above.

vanaja wrote on Thursday, January 03, 2019:

Hi,

Iam trying to implement TCP on LPC1768 and facing the same problem.
Iam getting errors like:
undefined reference to EMAC_CheckReceiveIndex. Similarly undefined reference to EMAC_GetReceiveDataSize,EMAC_NextPacketToRead,EMAC_UpdateRxConsumeIndex,
ucMACAddress,EMAC_CheckTransmitIndex,uxRand,vLoggingPrintf and so on.

LPC18xx has lpc18xx_emac.c file bt its missing for LPC17xx series.

Appreciate your help
Thanks

alager12345 wrote on Tuesday, March 05, 2019:

I’m struggling with this too. Here is what I’ve got working using the lpc177x_8x_emac.c driver.

BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer , BaseType_t xReleaseAfterSend )
{
    BaseType_t xReturn = pdFAIL;
    int32_t x;


	/* Attempt to obtain access to a Tx buffer. */
	for( x = 0; x < niMAX_TX_ATTEMPTS; x++ )
	{
		if( EMAC_CheckTransmitIndex() == TRUE )
		{
			/* Will the data fit in the Tx buffer? */
			if( pxNetworkBuffer->xDataLength < EMAC_ETH_MAX_FLEN ) /*_RB_ The size needs to come from FreeRTOSIPConfig.h. */
			{
				/* copy the buffer to the Tx DMA descriptor. */
				EMAC_PACKETBUF_Type TXBuffer;
				TXBuffer.ulDataLen = pxNetworkBuffer->xDataLength;
				TXBuffer.pbDataBuf = (uint32_t *)pxNetworkBuffer->pucEthernetBuffer;
				EMAC_WritePacketBuffer( &TXBuffer );
				EMAC_UpdateTxProduceIndex();

				/* The EMAC now owns the buffer. */
				pxNetworkBuffer->pucEthernetBuffer = NULL;

				iptraceNETWORK_INTERFACE_TRANSMIT();

				/* The Tx has been initiated. */
				xReturn = pdPASS;
			}

			break;
		}
		else
		{
			vTaskDelay( niTX_BUFFER_FREE_WAIT );
		}
	}

	/* Finished with the network buffer. */
    if( xReleaseAfterSend != pdFALSE )
		vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );

	return xReturn;
}

alager12345 wrote on Tuesday, March 05, 2019:

The problem I run into though, is that after some random time, I get an assert error in pxDuplicateNetworkBufferWithDescriptor(). It looks like sometimes pxGetNetworkBufferWithDescriptor() will return a valid buffer but the pointer inside that points to pucEthernetBuffer is NULL. Maybe I should start a new thread on this.

alager12345 wrote on Thursday, March 07, 2019:

My above code isn’t complete. check over on github for a complete posting:
https://github.com/aws/amazon-freertos/issues/365

Hello,

You got work this version well with LPC17XX, because i thinking to port my old version of LWIP for this FreeRTOS-TCP.

Ulysses, if you decide to use FreeRTOS+TCP on a LPC17XX, you can get all support here on this forum. It would be good if you open a new thread for that purpose.
Thanks, Hein

Please open the thread in the “Libraries” forum category, rather than the kernel category.

Hello Vladimir,
I know it is quite an old post but I haven’t found more recent posts about this topic. I also must port the FreeRtos+TCP to an LPC1788 board and I wonder if you were able to make it work.

Regards.

Hi @Gonzagds,
As this thread mentioned, LPC18xx hasn’t beend used for a while.
But I found a discussion here in wolfssl forum. @ulysses has done some integration with LPC1788.
You can take a look at this thread for more information.

Thanks.

1 Like

Hi @Gonzagds
Welcome to the FreeRTOS Community Forum. In addition to the resource shared by @ActoryOu , you can also go through this previous forum post and see if it helps to resolve your issue.

Thanks.

Hi @ActoryOu,
Thanks a lot for your help. I’ll take a look at the discussion.

Regards.