---
title: "Open Source Bitcoin ASIC miner project that uses 2x BM1387 (Antminer S9)"
url: "https://maker.wiznet.io/luca__________/projects/bitcoin-mining-using-w5500/"
markdown_url: "https://maker.wiznet.io/luca__________/projects/bitcoin-mining-using-w5500/md"
type: "UCC: User Created Content"
author: "NebulaMiner"
author_url: "https://bitcointalk.org/index.php?topic=5400851.180"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "NebulaMiner"
original_url: "https://bitcointalk.org/index.php?topic=5400851.180"
published: "2023-08-02"
language: "en"
hardware: ["Espressif ESP32-S3", "WIZnet W5500", "WIZnet W5500-EVB-Pico"]
likes: 2
views: 2231
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Open Source Bitcoin ASIC miner project that uses 2x BM1387 (Antminer S9)

> Bitcoin mining ASIC chip open-source project : can be using W5500 #Wiznet

Original author: NebulaMiner (source: https://bitcointalk.org/index.php?topic=5400851.180)

## Components

- **Espressif ESP32-S3** x 1
- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))
- **WIZnet W5500-EVB-Pico** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/w5500-evb-pico))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

Hi, Everyone.

It's Luca.

Let me introduce one person's says in Bitcoin forum.

Maybe I found a reason why W5500-EVB-PICO is a great product.

I was ASIC designer before, so this project is very interesting to me.

Let's start !

The Bitcoin ASIC miner forum link is here : <https://bitcointalk.org/index.php?topic=5400851.180>

**Related Git-hub links are here :**

Embedded framework solution = <https://github.com/newAM/ambientsensor-rs,>

Rust Embedded environment = <https://github.com/newAM/w5500-rs>

Open source Bitcoin miner hardware using BM1397 ASICs : **https://github.com/skot/bitaxe**

You need a basic firmware running on the ESP32 that will power up the ASIC

========================================================================

========================================================================

========================================================================

Rust FW for bitaxe is a big subject i am working on everyday. As I said in a previous post, it is better someone work on **a standard C FW** based on existing component (cgminer) instead of waiting for the Rust solution which will take longer time.

There not such "cgminer porting **in Rust**", cgminer is heavyly dependant on C. The best I can do, is to use cgminer driver for BM1397 based HW, to understand the low level (undocumented) protocol. Then code a (Rust) driver for BM13xx (based on Rust Embedded-Hal abstraction).

To update on my progress doing so, I received the broken T17 I brought on ebay (2 hashboard seems to be functional enough to be communicating) with stock FW, so I was able to log serial/i2c communication between ControlBoard and HashBoard using Saleae Logic2 (logic analyzer) and code a High Level Analyzer to parse the Serial Protocol (communication with BM13xx), it is available on <https://github.com/GPTechinno/bm13xx-hla>. Basic communication protocol is covered, I am into understanting the registers and their fields now. For this I do cross comparaison with S9k log (BM1393) with stock FW I also have on hand. I will also try different custom FW for the T17 (including BraiinsOS+) to learn how these differents flavor handle the same HW. I would be also very interested to have more log from other miner (S17...). So a lot of work need to be done in this direction...

For the **ESP32-S3 selection,** it is the most ESP32 capable chip, that's why I guess Skot selected it. Its exotic architecture (Xtensa) make it less compatible with existing project. Nevertheless, esp-rs, which is the Rust support for ESP32 family seems to have active community and good result. Basically, there is 2 flavors :
- one based on IDF (the framework supplied by Espressif, based on FreeRTOS, so a low level OS in C, that can handle all wifi/network layers) where Rust application can be run on top (so kind of a mixed C/Rust embedded). To my personal point of view, considering this approach, it is better to have a full IDF FW with existing cgminer C cross compiled to it, no need for Rust here, this is the "standard C FW" I was refering to earlier.
- one based on plain Rust, but no wifi/network is available yet.

IMHO wifi is not reliable enought for 24/7 mining device, copper wire (Ethernet) is much more prefered here. That's why I have close look also into **W5500** SPI/Ethernet bridge from **Wiznet** (I used them a lot in many other project), that has a very good support in Rust Embedded enviroment (<https://github.com/newAM/w5500-rs>).

**For the Rust embedded framework, there is mainly 2 solutions :**

- **RTIC **: Real Time Interrupt-driven Concurrency which I am not yet fully documented. Community seems very active. Alex (from w5500-rs) has a project example with it (<https://github.com/newAM/ambientsensor-rs>).

- **Embassy** : EMBedded ASYnc, which I start to love more and more. It has great support for STM32 and RP2040 (RPi PICO chip) but no ESP32 yet. **w5500-embassy is not finish yet, **but Alex gave me access to its private repo where job is ongoing there. I will try to make progress on it.

I think **a great HW** for this, is the **W5500-EVB-PICO, basically a RP2040 with a W5500 on a stick (brought 2 of them).** RP2040 is a dual core Cortex-M0+ at 133MHz. Having a dual core look promising to have one core for the Network (Ethernet/W5500/StratumV2), and the second one for the BM13xx serial handling. Embassy seems to be able to deal with these 2 differents contexts (not tried yet).

Finally, why I think Rust is way to go for a embedded miner, it is mainly because Stratum V2 Reference Implementation is done in Rust (https://github.com/stratum-mining/stratum), I recently joined their weekly dev meeting and they seems to be interesting into a first embedded implementation. It can be done on the ESP32-S3 on top of IDF without the need to have actual BM13xx I think.

========================================================================

========================================================================

========================================================================

If you are Korean, visit this Korean website describing W5500-embassy: *https://inmile.tistory.com/m/63*

Above says that **w5500-embassy is not finish yet, but I FOUND some repository about that.Let's see this repository.**

I think <https://github.com/embassy-rs/embassy/tree/main/embassy-net-w5500> is useful repo for Wiznet users. It's about embassy-net related to our product, w5500

======

Let's study about W5500!

![](https://maker.wiznet.io/upload/ckeditor5/418544830%5F1691102914%2Epng)

```
WIZnet W5500은 연결 기능을 갖춘 내장 이더넷 컨트롤러입니다.
인터넷 또는 로컬 영역에 대한 단순화된 연결을 제공하는 TCP/IP
SPI(Serial Peripheral Interface)를 사용하는 임베디드 시스템용 네트워크.
W5500은 안정성이 필요한 경우에 가장 적합합니다.
단일 칩을 사용하여 인터넷 또는 로컬 네트워크에 연결 TCP/IP 스택, 10/100 이더넷 MAC 및 PHY를 구현합니다. TCP/IP 스택
TCP, UDP, IPv4, ICMP, ARP, IGMP 및 PPPoE 등을 지원합니다. 그것은
수년에 걸쳐 다양한 프로그램에서 입증되었습니다. W5500 사용
데이터 전송을 위한 메모리로 32KB의 내부 버퍼.
W5500을 사용하여 이더넷 응용 프로그램을 구현할 수 있으며,
작업하는 대신 간단한 소프트웨어 소켓 기술을 사용하여
복잡한 알고리즘을 작성해야 하는 복잡한 이더넷 컨트롤러.
8개의 독립적인 하드웨어 소켓을 동시에 사용할 수 있습니다.
SPI(Serial Peripheral Interface)는 외부와의 쉬운 통합을 제공합니다.
마이크로 컨트롤러. W5500 SPI는 최대 80의 데이터 속도를 지원합니다.
메가헤르츠 시스템 전력 소모를 줄여야 하는 경우 W5500
WOL(Wake on LAN) 및 전원 끄기 모드를 제공합니다.
```

```
PLL은 여러개의 클럭을 생성하여 모듈에 제공합니다.
```

```
To estimate the needed bps for running cgminer, I asked to Chat-GPT.
```

```
the result is below.
```

![](https://maker.wiznet.io/upload/ckeditor5/846171549%5F1691339709%2Epng)

```
Thank you a lot!
```

---

Source: https://maker.wiznet.io/luca__________/projects/bitcoin-mining-using-w5500/
