Quality RTOS & Embedded Software

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


FreeRTOS+TCP with STM32F429 and LAN8720

Posted by mgolebiowski on October 6, 2016

Hello, I'm doing a project on STM32F429ii and LAN8720( http://ww1.microchip.com/downloads/en/DeviceDoc/00002165B.pdf ) PHY with FreeRTOS. It'll serve a Webserver with continuous data fetch over AJAX and Modbus TCP.

I have a working version based on LwIP and Demo from ST but there are problems with long working continuous data fetch propably because of LwIP or ST's ETH driver.

I'm now trying to set up the FreeRTOS+TCP stack instead of LwIP. I used this demo http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCP-IPFATExamplesSTSTM32F407.html as a starting point but I have problems with make the TCP stack working with my hardware.

And here is the question: what should I change in NetworkInterface.c and HAL driver in this demo to make it working with my PHY? Unfortunately changing the defines (like PHYBCR etc.) and GPIOs HALETH_MspInit is not enough and it's still not responding for pings.

Thanks for help, Michal

FreeRTOS+TCP with STM32F429 and LAN8720

Posted by rtel on October 6, 2016

As you have a working driver for your existing lwIP example I presume you already have a working initialise and transmit function - albeit with the lwIP function names rather than the function names FreeRTOS+TCP expects.

As a starting point I would suggest using the lwIP initialisation function, but call it xNetworkInterfaceOutput(), so it links with FreeRTOS+TCP. That way you don't need to change any of the PHY code as you have it working already.

You will probably also be able to use the lwIP transmit function, which can be renamed xNetworkInterfaceOutput() so it links with FreeRTOS+TCP, but that will require some updates as the packets passed into the function for transmission will be in FreeRTOS+TCP network buffers rather than lwIP network buffers.

That should be enough to see data going out onto the network - once that is working you can then create the receive function from the lwIP receive function too, but again you will have to adapt it to package the received data in FreeRTOS+TCP network buffers rather than lwIP network buffers. In this case there is no specific function name that is needed, but you do need to send the network buffers on a queue. You will see how that is done in the FreeRTOS+TCP STM32 driver that you are already using as a reference.

Once things are just 'working' you can look at how you could optimise them for FreeRTOS+TCP, if optimisation is a concern.


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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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