# Can I add ethernet support to my klipper stm32f103 ? (ENC28J60,LAN8720 or W5500)

**URL:** <https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733>\
**Category:** General Discussion\
**Created:** [March 7, 2024, 7:37am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733 "2024-03-07T07:37:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shodan](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shodan](https://klipper.discourse.group/u/shodan)\
**Post date:** [March 7, 2024, 7:37am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/1 "2024-03-07T07:37:40Z")

</div>

Hi,  
I wish to run only 3 axes off an stm32f103 and some tmc2209 drivers.

I would like to receive the instructions from klipper-host over ethernet.

On the host side, I would I would create a virtual tty using socat and send it over tcp/ip over ethernet.

I am curious how hard it would be to do this, if there even is enough cpu time left on the stm32f1 to do this.

I would use one of these 3$ to 5$ ethernet interfaces ENC28J60, LAN8720, W5500

I assume one of these libraries would be sufficient

> **[GitHub - UIPEthernet/UIPEthernet: UIPEthernet library for Arduino IDE,Eclipse...](https://github.com/UIPEthernet/UIPEthernet)**
>
> UIPEthernet library for Arduino IDE,Eclipse with arduino plugin and MBED/SMeshStudio (AVR,STM32F,ESP8266,Intel ARC32, Nordic nRF51, Teensy boards,Realtek Ameba(RTL8195A,RTL8710)), ENC28j60 network ...

> **[GitHub - ARM-software/CMSIS-Driver: Repository of microcontroller peripheral...](https://github.com/ARM-software/CMSIS-Driver)**
>
> Repository of microcontroller peripheral driver implementing the CMSIS-Driver API specification - ARM-software/CMSIS-Driver

https—github.com-afiskon/stm32-w5500

If successful, I would try to run a second stm32f1 in my extruder to operate the stepper, heater, thermistor, accelerometer and fans

---

<div class="post-metadata">

**Author:** ![shodan](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shodan](https://klipper.discourse.group/u/shodan)\
**Post date:** [April 16, 2024, 6:41am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/2 "2024-04-16T06:41:07Z")

</div>

According to chatgpt, the following already supported MCU would be suitable for use with these chips

For applications requiring very low bitrate communications over Ethernet, the choice of microcontroller (MCU) must be compatible with Ethernet controllers like ENC28J60, LAN8720, or W5500. Here are suitable MCUs for each Ethernet controller, considering their ability to interface efficiently and manage network communications at low bitrates:

1. ENC28J60 (SPI interface):

2. LAN8720 (RMII interface):

3. W5500 (SPI interface):

What about the RP2040 ?

 ![GPT](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/7/7fc784312e29487a441fc468ed8c491ed2d25803.png)

The **RP2040** by Raspberry Pi can also be used for very low bitrate applications over Ethernet, especially considering its flexible I/O options and efficient processing capabilities. However, the RP2040 does not have a native Ethernet MAC, so you will need to use an external Ethernet controller. Here’s how you can use it with the specified Ethernet controllers:

**1. ENC28J60 (SPI interface):**

- **RP2040** : This MCU supports SPI communication, making it compatible with the ENC28J60. Libraries like the Arduino Ethernet library can be used to facilitate this connection, allowing for TCP/IP stack handling over SPI.

**2. LAN8720 (RMII interface):**

- **RP2040** : Normally, interfacing RP2040 with an RMII-based controller like the LAN8720 is not straightforward because RP2040 does not support RMII directly. However, it is possible through bit-banging or using additional components like a small FPGA or a microcontroller that acts as a bridge. This is more complex and might not be the most efficient route for very low bitrate applications unless specific conditions or existing components necessitate it.

**3. W5500 (SPI interface):**

- **RP2040** : Connecting the RP2040 with the W5500 using SPI is a more straightforward approach. The W5500 has an integrated TCP/IP stack, which offloads much of the networking function from the RP2040, making it an excellent choice for efficient network communication with minimal MCU overhead.

For applications that prioritize simplicity and ease of setup, using the RP2040 with SPI-based Ethernet controllers like the ENC28J60 or W5500 is advisable. These setups benefit from the RP2040’s high-speed SPI interface and ample processing power, making it suitable for handling low data rate communication tasks effectively while being energy efficient. Additionally, the Pico SDK and various community libraries support the integration of these Ethernet chips with the RP2040, which can help streamline development.

---

<div class="post-metadata">

**Author:** ![shodan](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shodan](https://klipper.discourse.group/u/shodan)\
**Post date:** [April 16, 2024, 4:36am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/3 "2024-04-16T04:36:56Z")

</div>

I want all my printers connected via wired ethernet.

I found several wifi to serial firmware, especially for the esp8266 and esp32.

But there are few firmware for wired ethernet.

I think what shows the most promise is the

esphome firmware, ethernet to serial streaming

I tried searching advice for doing this, but there is much confusion as people are talking about using ethernet and wifi to connect to their mainsail or other interface API, never the connection between klippy and klipper.

To note, the LinuxCNC project, which refuses to work on anything not realtime, also uses ethernet between Host and MCU, so I know ethernet is good enough for this. Also the 5 axis machines at work by DMG, use ethernet to control the servo/stepper drivers in the machine, so it is a viable solution.

> **[GitHub - oxan/esphome-stream-server: Stream server (serial-to-wifi bridge)...](https://github.com/oxan/esphome-stream-server)**
>
> Stream server (serial-to-wifi bridge) for ESPHome - GitHub - oxan/esphome-stream-server: Stream server (serial-to-wifi bridge) for ESPHome

For the boards, could be

8$ W32-ETH01

> **[WT32-ETH01\_datasheet\_V1.1-%20en.pdf](https://files.seeedstudio.com/products/102991455/WT32-ETH01_datasheet_V1.1-%20en.pdf)**
>
> 666.83 KB

19$USD Olimex ESP32-PoE-ISO

> **[ESP32-POE - Open Source Hardware Board](https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware)**
>
> ESP32-POE IoT development board with 100Mb Ethernet, Power over Ethernet, WiFi, BLE, programmer

19$ LILYGO T-Internet-POE

> **[T-Internet-POE](https://www.lilygo.cc/en-ca/products/t-internet-poe)**
>
> LILYGO® TTGO T-Internet-POE ESP32-WROOM LAN8720A Chip Ethernet Adapter And Downloader Expansion Board Programmable Hardware  Specifications MCU ESP32 FLASH 4MB Wireless Connectivity Wi-Fi:802.11 b/g/n/, BLE V4.2 Onboard Buttons RST+BOOT Support...

On linux or windows side, the serial-to-ethernet virtual COM/TTY port  
Would be provided by socat

> **[socat(1): Multipurpose relay - Linux man page](https://linux.die.net/man/1/socat)**
>
> Socat is a command line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be ...

on windows com0com 's com2tcp (not the commercial, unrelated com2tcp)  
[https://com0com.sourceforge.net/](https://com0com.sourceforge.net/)

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [April 16, 2024, 6:54am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/4 "2024-04-16T06:54:29Z")

</div>

Your two threads go into the same direction, so I merge them.

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [April 16, 2024, 6:57am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/5 "2024-04-16T06:57:53Z")

</div>

If you run your printers with a SBC each, you can locate the SBC near the printer. The SBC usually have Ethernet connectivity.

---

<div class="post-metadata">

**Author:** ![shodan](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shodan](https://klipper.discourse.group/u/shodan)\
**Post date:** [April 16, 2024, 7:13am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/7 "2024-04-16T07:13:30Z")

</div>

I am running 9x printer off a single linux x86 PC, however having many, long USB wires to connect to serial bridges is clumsy. And sometimes the devices name exchange places so one printer becomes another.

That is why I wish to use ethernet.

I no longer use raspberry pi as they are too expensive, more than half the price of the whole printer each and not very fast compared with a PC !

Also, I wish the replace the mainboard in my printer into simpler, multiple boards, each ethernet connected.

So that would be one tiny ethernet board for the extruder

One “board” (or single CH32V003 attached to a W5500) to run only the XY or AB

And a third board that runs only the Z\* axies, endstops, lights, bed heater and other accessories.

All of this plugged into a PoE surplus 24 port 100M cisco switch that costs under 50$

Although I understand this might upset the Klipper sponsors. Since the CH32V003 only costs 0.30$ for the “big” version and the W5500 is 3$. This does not leave much profit margin for board sellers.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [June 15, 2024, 7:14am UTC](https://klipper.discourse.group/t/can-i-add-ethernet-support-to-my-klipper-stm32f103-enc28j60-lan8720-or-w5500/14733/8 "2024-06-15T07:14:02Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
