[email protected] Contact Us: +86 0755-2871-6564 Welcome to Shenzhen Jinxinyang Technology Co., Ltd. !
banner
News
E5908 module Ethernet communication implementation solution
2025/4/21 15:56:55
E5908 module Ethernet communication


Home news E5908 module Ethernet communication implementation solution


Introduction

Integration E5908 This article will deeply analyze the full-link technology implementation of Ethernet interface development, taking the E5908 RJ45 interface as an example, and provide a feasible hardware design guide, driver development method and protocol stack integration solution. Each layer of technology implementation contains directly reusable code snippets and verification methods.

E5908 module hardware layer design and implementation

The E5908 module is a serial-to-Ethernet communication module that integrates TCP/IP protocol stack and Ethernet control logic, and outputs UART signals. To implement the RJ45 physical interface, there are two common solutions:

Solution 1: Use E5908's built-in serial port + external PHY

Connection solution:

[MCU] <--uart--> [E5908] <--PHY chip+RJ45--> [Ethernet]
  • RJ45 interface: standard 8P8C, with or without shielding optional.
  • Magnetic isolation: prevent ground loop interference and improve signal integrity.
  • PHY chip: handles 10/100/1000Base-T physical layer.
  • MAC control: integrated in MCU or external MAC chip, connected to PHY through RMII/MII interface.

Core elements:

Hardware components Description
E5908 module Core serial port to Ethernet module with internal protocol stack
MCU (optional Control end, can be STM32, 51 series, etc. according to the scenario
RJ45 interface TCP/IP protocol support
PHY chip Usually built-in module or integrated in RJ45 (some modules need external connection)

Circuit connection instructions:

  • E5908 UART TX/RX ↔ MCU UART RX/TX;
  • Power supply 3.3V or 5V, with TVS diode protection
  • GPIO control pins can be connected to external buttons or MCU control;
  • If the RJ45 interface is a magnetic coupling integrated model, VLAN isolation and EMI suppression are better;
  • Use a regulated LDO power supply to ensure clean power supply and avoid serial port errors.

Solution 2: MCU controls PHY, E5908 only transmits serial port transparently

Applicable to transparent transmission scenarios when MCU is responsible for TCP/IP protocol stack:

[Power supply] +5V → AMS1117-3.3 → 3.3V → module ↘ TVS + decoupling capacitor [Serial port] MCU_TX - 100Ω -> E5908_RX MCU_RX <- 100Ω - E5908_TX

Tip:1 Gbps recommends RGMII/GMII, 100 Mbps can use RMII.

Firmware/Driver Layer

The E5908 module integrates network control internally and does not provide external MDIO/MDC. If you need to manage PHY, please use an MCU with a MAC controller (such as STM32F7/H7) to control the external PHY through MDC/MDIO.

// STM32 configuration example MX_ETH_Init(); #define PHY_ADDRESS 0x01 HAL_ETH_WritePHYRegister(&heth, PHY_ADDRESS, PHY_BCR, PHY_RESET); HAL_Delay(50); uint32_t sr; HAL_ETH_ReadPHYRegister(&heth, PHY_ADDRESS, PHY_BSR, &sr); if (sr & PHY_LINKED_STATUS) printf("Link OK\n");

Protocol stack layer

If the E5908 module's RJ45 interface is running in a bare metal or RTOS (such as FreeRTOS + LwIP/FreeRTOS-TCP) environment, its protocol stack implementation will be different from the standard Linux/Android environment, which is usually more lightweight and requires manual configuration.

#include "lwip/netif.h" #include "lwip/dhcp.h" #include "ethernetif.h" struct netif gnetif; void Netif_Config(void) { ip_addr_t ip = IPADDR4_INIT(0,0,0,0); ip_addr_t nm = IPADDR4_INIT(0,0,0,0); ip_addr_t gw = IPADDR4_INIT(0,0,0,0); netif_add(&gnetif, &ip, &nm, &gw, NULL, ethernetif_init, ethernet_input); netif_set_default(&gnetif); dhcp_start(&gnetif); }

Embedded Linux

ip link show eth0 dhclient eth0

Application Layer

After obtaining the IP address, the E5908 RJ45 module can indeed exchange data through a standard Socket.

C Example

#include #include #include #include #include #include #define PORT 8080 #define BUFFER_SIZE 1024 int main() { int sock = 0; struct sockaddr_in serv_addr; char buffer[BUFFER_SIZE] = {0}; const char *hello = "Hello from Client"; if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("Socket creation error"); exit(EXIT_FAILURE); } serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(PORT); if (inet_pton(AF_INET, "192.168.1.100", &serv_addr.sin_addr) <= 0) { perror("Invalid address / Address not supported"); exit(EXIT_FAILURE); } if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { perror("Connection failed"); exit(EXIT_FAILURE); } send(sock, hello, strlen(hello), 0); printf("Message sent: %s\n", hello); read(sock, buffer, BUFFER_SIZE); printf("Server response: %s\n", buffer); close(sock); return 0; } }

Python example

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("E5908_IP", Port Number))
s.send(b"data")
response = s.recv(1024)
s.close()

Summarize

To ensure the overall reliability of the system, it is necessary to optimize signal integrity (SI) in the hardware design phase, solve compatibility issues at the driver layer, and ensure stability at the protocol stack level. Finally, through the standard Socket interface, the application layer can efficiently achieve cross-platform communication, perfectly matching the application requirements of IoT and embedded Linux .

Jinxinyang Technology

We are a professional electronic components distributor, providing a full range of products and saving you a lot of time, energy and cost through efficient self-customization services. Carefully prepare orders and deliver services quickly.

FAQ

What Ethernet communication methods does the E5908 module support?

The module supports both Socket communication and Ethernet-to-serial port communication.

How to view and configure network interfaces in Linux?

Use 'ip link show eth0' to view interface status, and 'dhclient eth0' to obtain a DHCP-assigned IP address.

What is the default LAN listening port?

The default listening port is 8899, which can be customized to other ports as needed.


Copyright © 2022 Shenzhen Jinxinyang Technology Co., Ltd.