This repository contains an example project that demonstrates how to use the LWIP (Lightweight IP) library and FREERTOS on an STM32 microcontroller, specifically STM32F429ZIT6 Nucleo board, to send and receive data using socket API. The example showcases the setup and usage of LWIP to establish network communication over Ethernet and demonstrates client functionality.
Before you begin, ensure that you have the following prerequisites:
- STM32 development board with Ethernet connectivity, we use STM32F429ZIT6 Nucleo board for this example.
- STM32CubeIDE and STM32CubeMX for STM32 development.
- Ethernet cable to connect to the router.
- Router with Ethernet ports to configure IP for STM32 development board and server.
- Clone this repository to your local machine.
- Open the project in your preferred STM32 development environment.
- Configure the necessary settings such as microcontroller selection, linker script, and system clock.
- Open the project in STM32CubeIDE.
- Configure the IP address server settings for the client applications in line 17, 18 of the
socket_client.c
file and in line 12, 69 of thesocket_server.py
file.
socket_client.c
:
socket_server.py
:
- Build and flash the client applications code to separate STM32 development boards.
- Run python socket_server.py or use Hercules SETUP utility to run server application.
- Use debugging tools to monitor the status of the communication and the messages communicated by the client.
Test server using Hercules tool to check the client connection status, data received from client and send data to client
Test server using Python application to receive data form client, check the size of data received and send data to client
We have a related blog post with further details on this example, which you can find here for reference: https://www.industry.com.vn/an-overview-of-lightweight-internet-protocol/