User Guide
GD32E507Z-EVAL
34/43
5.24.2. Raw_tcpudp
DEMO purpose
This demo includes the following functions of GD32 MCU:
Learn to use Lwip stack
Learn to use raw API to handle with a task
Learn how to realize a tcp server
Learn how to realize a tcp client
Learn how to realize a udp server/client
Learn how to use DHCP to allocate ip address automatically
Learn to handle with received packet in polling mode and in interrupt mode
This demo is based on the GD32E507Z-EVAL-V1.0 board, it shows how to configure the enet
peripherals to send and receive frames in normal mode and use lwip tcp/ip stack to realize
ping, telnet and server/client functions.
JP10, JP14, JP15, JP16 must be fitted. JP13 jump to Usart0.
It is configured in RMII mode, and 25MHz oscillator is used, the system clock is configured to
180MHz.
This demo realizes three applications:
1) Telnet application, the eval board acts as tcp server. Users can link the client with the
eval board server, using 8000 port. Users can see the reply from the server, and can send
the name(should input enter key) to server.
2) tcp client application, the eval board acts as tcp client. Users can link the eval board
client with the server, using 10260 port. Users can send information from server to client, then
the client will send back the information. If the server is not online at first,or is break during
process, when the server is ready again, users can press tamper key to reconnect with server,
and communicate.
3) udp application. Users can link the eval board with another station, using 1025 port.
Users can send information from station to board, then the board will send back the
information.
By default, the packet reception is polled in while(1). If users want to receive packet in interrupt
service, uncomment the macro defined USE_ENET_INTERRUPT in main.h.
If users need dhcp function, it can be configured from the private defines in main.h. This
function is closed in default.
Note: Users should configure ip address, mask and gw of GD32E507Z-EVAL-V1.0 board, or
server according to the actual net situation from the private defines in main.h.
DEMO running result