FreeRtos+UDP and FreeRtos+TCP with LPC1769

hardware-dev wrote on Thursday, November 17, 2016:


We have tested the example code FreeRTOSPlusUDPandCLILPC1830GCC. It seems to work well.
Now we would like to port this example to our microcontroller LPC1769.

In the zip-package from FreeRtos there is a folder with drivers for LPC1769:

So I took the file “NetworkInterface.c” from this folder and put it into my project in place of original file for LPC1830.

I also added the driver files for emac:

  • lpc17xx_emac.c
  • lpc17xx_emac.h
  • and all other files which were needed.

Now the compiler can’t find the following functions:

  • EMAC_NextPacketToRead();
  • EMAC_SetNextPacketToSend();
  • EMAC_StartTransmitNextBuffer();

I can find that functions in the driver for LPC1830 but they don’t work with LPC1769.

The questions are as follows:

  • Is this driver “NetworkInterface.c” for 1769 incomplete?
  • What do I have to do to get it work?

Our target is to use the FreeRtos+TCP (we need webserver and UDP), but there is no example code for our LPC microcontrollers. That is why we would like to port the example FreeRTOSPlusUDPandCLILPC1830GCC. If it works correctly, then we will try to port the FreeRtos+TCP.

paw3l wrote on Thursday, November 17, 2016:

Are you aware that you will need also Fat to get this system to work? Or modify the filesystem API to do some raw access to flash etc. Unless you have plenty of space on externel memory.

hardware-dev wrote on Thursday, November 17, 2016:

Why do I need FAT? I thought it should also work without it.
We have a sd-card and external Flash memory on our board, if it is needed.

rtel wrote on Thursday, November 17, 2016:

In the LPC18xx example EMAC_NextPacketToRead() is implemented in the
lpc18xx_emac.c souce file - which is a driver file provided by NXP, and
it seems the LPC17xx version of NetworkInterface.c expects the
equivalent LPC17xx driver from NXP to provide the same function. It
sounds like the version of lpc17xx_emac.c that you are using (is that
from NXP too?) is different to the one used when the networkinterface.c
file for that chip was written. Look in your lpc17xx_emac c and h
source files to see what it calls the functions that you are missing -
I’m sure they will be there but it sounds like they are named differently.

hardware-dev wrote on Friday, November 18, 2016:

Thank you very much for your answer.
Yes, the file lpc17xx_emac.c is from NXP. The name of the library is:
LPC175x_6x CMSIS-Compliant Standard Peripheral Firmware Driver Library

I also thought that the functions should be there but with other names.

There are following functions lpc18xx_emac.c:

BaseType_t EMAC_Init(EMAC_CFG_Type *EMAC_ConfigStruct);
int32_t EMAC_UpdatePHYStatus(void);
uint32_t EMAC_GetReceiveDataSize(void);
void EMAC_StartTransmitNextBuffer( uint32_t ulLength );
void EMAC_SetNextPacketToSend( uint8_t * pucBuffer );

void EMAC_NextPacketToRead( xNetworkBufferDescriptor_t *pxNetworkBuffer );
void EMAC_UpdateRxConsumeIndex(void);
BaseType_t EMAC_CheckReceiveIndex(void);
BaseType_t EMAC_CheckTransmitIndex(void);

Whereas in lpc17xx_emac.c I can find:

Status EMAC_Init(EMAC_CFG_Type *EMAC_ConfigStruct);
void EMAC_DeInit(void);
int32_t EMAC_CheckPHYStatus(uint32_t ulPHYState);
int32_t EMAC_SetPHYMode(uint32_t ulPHYMode);
int32_t EMAC_UpdatePHYStatus(void);
void EMAC_SetHashFilter(uint8_t dstMAC_addr[], FunctionalState NewState);
void EMAC_SetFilterMode(uint32_t ulFilterMode, FunctionalState NewState);
void EMAC_WritePacketBuffer(EMAC_PACKETBUF_Type *pDataStruct);
void EMAC_ReadPacketBuffer(EMAC_PACKETBUF_Type *pDataStruct);
void EMAC_IntCmd(uint32_t ulIntType, FunctionalState NewState);
IntStatus EMAC_IntGetStatus(uint32_t ulIntType);
Bool EMAC_CheckReceiveIndex(void);
Bool EMAC_CheckTransmitIndex(void);
void EMAC_UpdateRxConsumeIndex(void);
void EMAC_UpdateTxProduceIndex(void);
FlagStatus EMAC_CheckReceiveDataStatus(uint32_t ulRxStatType);
uint32_t EMAC_GetReceiveDataSize(void);
FlagStatus EMAC_GetWoLStatus(uint32_t ulWoLMode);

I cannot find equivalent functions.
Could you suggest which functions should I use?

rtel wrote on Friday, November 18, 2016:

Well the write and read packet buffers would seem the place to start,
but really, just seeing the function names means all I can do is guess,
which is not going to help you. You have the source files and
presumably examples of how to use them, so study what you have.