🛠 Complete Use Case: Ethernet Connectivity for Raspberry Pi Pico

Olimex UEXT-CH390: SPI to Ethernet 10/100 Mbps Module for Microcontrollers · debutant · Connectez votre Raspberry Pi Pico à un réseau filaire stable en utilisant la carte UEXT-CH390 pour des projets IoT fiables.

Objectives

This tutorial aims to transform a Raspberry Pi Pico into a reliable Ethernet network node. Unlike Wi-Fi, which is prone to interference, Ethernet offers constant latency and enhanced security. We will configure the UEXT-CH390 card to obtain an IP address via DHCP and verify connectivity.

Required Material

Steps

  1. Hardware Preparation: Insert the UEXT-CH390 card into the UEXT connectors of the Raspberry Pi Pico. Ensure the pins are aligned correctly. The module is powered at 3.3V via the UEXT bus.
  1. Software Configuration: Open your development environment (Arduino IDE or Pico SDK). Select the "Raspberry Pi Pico" board. You will need the specific library for the CH390 driver. If using the SDK, ensure you include lwIP sources compatible with the CH390.

// Simplified example for Arduino IDE #include "CH390.h" CH390 eth; void setup() { Serial.begin(115200); // SPI and CH390 initialization if (!eth.begin()) { Serial.println("CH390 initialization failed"); while(1); } // Start DHCP if (eth.dhcp()) { Serial.print("IP Address obtained: "); Serial.println(eth.localIP()); } } void loop() { eth.maintain(); // Maintain connection }

  1. Network Initialization: In your code, initialize the SPI interface and the CH390 controller. The module uses the SPI interface in mode 0 or 3. Here is a code structure example for initialization:```cpp

4. **Compilation and Upload**: Compile the code and upload it to the Pico. Monitor the serial output to confirm that the module detected the physical link and obtained an IP address.

## Verification
Open a terminal on your computer. Use the command `ping <obtained_IP_address>`. If you receive replies, the connection is active. You can also check your router's administration interface to see if the device appears with a MAC address corresponding to the one factory-programmed on the CH390 module.

## To Go Further
Once basic connectivity is established, explore integration with home automation platforms. ESPHome firmware natively supports this type of configuration for OTA updates and automatic discovery by Home Assistant. You can also study the management of the CH390's 16KB SRAM buffers to optimize throughput in real-time data transfer applications.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials