Passer au contenu

Nous améliorons nos opérations pour mieux vous servir. Les commandes sont expédiées normalement depuis Laval, QC. Questions? Contactez-nous

Bitcoin accepté au paiement  |  Expédié depuis Laval, QC, Canada  |  Soutien expert depuis 2016

PX_SERIAL_UART Warning

PiAxe – BM1366 Serial UART Communication Error

PiAxe BM1366 Serial UART Communication Error | Raspberry Pi serial framing - pyminer.py fails with `BM1366 serial open failed`, `Permission denied: '/dev/ttyAMA0'`, or `framing error` because the Pi's hardware UART is held by serial-getty, the on-board Bluetooth modem, a conflicting dtoverlay, or because /dev/serial0 points at the mini-UART whose baud rate drifts under CPU load.

Warning — Should be addressed soon

Affected Models: PiAxe (Raspberry Pi + single BM1366 ASIC) on Pi 2 / Pi 3 / Pi 4 / Pi 5 / Pi Zero 2 W, running piaxe-miner / pyminer.py on Raspberry Pi OS Bullseye or Bookworm. Worst on Pi 3/4/5/Zero 2 W where Bluetooth claims the PL011 UART by default.

Symptoms

  • `pyminer.py` logs `BM1366 serial open failed`, `could not open serial port /dev/serial0`, or `PermissionError: [Errno 13] Permission denied: '/dev/ttyAMA0'` on startup
  • `dmesg` shows `8250.serial: ttyS0 at MMIO` but no `ttyAMA0` registration, or `ttyAMA0` reserved for bluetooth
  • `ls -l /dev/serial0` resolves to `/dev/ttyS0` (mini-UART) on Pi 3/4/5/Zero 2 W instead of the expected `/dev/ttyAMA0` (PL011)
  • `systemctl status serial-getty@ttyAMA0.service` or `serial-getty@ttyS0.service` shows active login getty holding the UART
  • `pyminer.service` enters a restart loop every 5-15 seconds with `BM1366 init failed` in `journalctl -u pyminer -f`
  • Pool dashboard hashrate stays at exactly 0 GH/s while Pi stays SSH-reachable with low CPU load
  • `stty -F /dev/serial0 115200` returns `Device or resource busy` or `Permission denied`
  • ACT / status LED on the BM1366 daughterboard never lights or blinks once at boot and stays dark
  • Manual write `echo -n "x55xaax52x05x00x00x0a" > /dev/serial0` returns `Permission denied` or `Input/output error`
  • Recently enabled a Pi camera overlay, GPS/LoRa HAT, or other dtoverlay that touches GPIO14/15 and mining stopped after reboot
  • Fresh Raspberry Pi OS Bookworm install - PiAxe has never hashed on this Pi, not a regression
  • Intermittent `framing error` / `checksum mismatch` / `no response from BM1366` at 5+ per minute once pyminer connects (mini-UART baud drift under CPU load)

Step-by-Step Fix

1

Run `sudo raspi-config`. Go to Interface Options -> Serial Port. Answer NO to `Would you like a login shell over serial?` then YES to `Would you like the serial port hardware to be enabled?`. Exit and reboot. This single move disables the serial-getty login prompt that otherwise holds `/dev/ttyAMA0` exclusive and blocks pyminer from opening it. Covers the majority of fresh-install failures on Pi 2 and older models.

2

Verify the boot result with `ls -l /dev/serial0` and `cat /proc/device-tree/model`. On Pi 2 or Pi 1 the symlink points at `/dev/ttyAMA0` and you are done. On Pi 3/4/5/Zero 2 W it usually points at `/dev/ttyS0` (mini-UART) because Bluetooth has the PL011. Note which Pi model you have - Tier 2 steps diverge by model.

3

Add your user to `dialout`. Run `groups $USER`. If `dialout` is missing, run `sudo usermod -aG dialout $USER` then log out fully and log back in (or run `newgrp dialout` in the current shell). This grants non-root access to `/dev/serial0`. Without it, pyminer hits PermissionError on open even when the port is otherwise free.

4

Start pyminer and watch logs: `sudo systemctl start pyminer && sudo journalctl -u pyminer -f`. Within 10 seconds you should see `BM1366 serial open OK` and `BM1366 chip response OK`. If it still fails, the port is contended by Bluetooth or an overlay - proceed to Tier 2. If it opens but you see intermittent framing errors, you are on mini-UART and need the Pi 3/4/5 fix in Tier 2.

5

Power-cycle the PiAxe cleanly: shutdown with `sudo shutdown -h now`, unplug Pi USB-C or barrel jack AND the BM1366 carrier 12V input, wait 30 seconds, plug Pi in first, wait for boot, then plug the BM1366 12V. This guarantees the ASIC sees a clean reset sequence before pyminer attempts to talk to it, avoiding stale-state init failures.

6

Reclaim the PL011 UART from Bluetooth on Pi 3/4/5/Zero 2 W. Edit `/boot/firmware/config.txt` (Bookworm) or `/boot/config.txt` (Bullseye) with `sudo nano`. Add the line `dtoverlay=disable-bt` (removes Bluetooth entirely, cleanest) OR `dtoverlay=miniuart-bt` (keeps Bluetooth on mini-UART, PiAxe gets PL011). Save. Run `sudo systemctl disable hciuart`. Reboot. Re-run `ls -l /dev/serial0`; it should now resolve to `/dev/ttyAMA0`.

7

Disable any lingering serial-getty services manually. Run `sudo systemctl disable --now serial-getty@ttyAMA0.service` and `sudo systemctl disable --now serial-getty@ttyS0.service`. raspi-config on early Bookworm releases occasionally leaves these active even after answering No to the login-shell prompt. Confirm with `systemctl list-units --type=service | grep serial-getty` - should be empty.

8

Audit your overlays. Run `grep -E '^dtoverlay|^dtparam' /boot/firmware/config.txt`. Any overlay that touches GPIO14/15 (camera overlays, certain GPS/LoRa HATs, `dtoverlay=uart0,txd0_pin=14,rxd0_pin=15` variants) preempts the UART. Comment out the conflicting line with a `#`, save, reboot. You cannot use a HAT that needs GPIO14/15 and run PiAxe on the same Pi - pick one.

9

Verify pyminer config uses `/dev/serial0` and NOT a hardcoded `/dev/ttyAMA0` or `/dev/ttyS0`. `cd ~/piaxe-miner && cat config.yaml` (or whatever config file your branch uses). Edit if hardcoded. `/dev/serial0` is a stable symlink that follows your disable-bt / miniuart-bt config - hardcoded paths break silently when you change overlays.

10

Fix the Bookworm pip PEP 668 trap if you hit `error: externally-managed-environment` during `pip3 install -r requirements.txt`. Create a virtualenv: `python3 -m venv ~/piaxe-venv && source ~/piaxe-venv/bin/activate && pip install -r requirements.txt`. Update your systemd unit `ExecStart` to use `~/piaxe-venv/bin/python pyminer.py`. Do NOT use `--break-system-packages` - it contaminates system Python and bites you six months later.

11

Stabilize baud rate on mini-UART deployments where you cannot use PL011. Set the CPU governor to performance: `sudo cpufreq-set -g performance`, persist with `echo 'GOVERNOR="performance"' | sudo tee -a /etc/default/cpufrequtils`. Mini-UART derives its baud from the VPU core clock, so CPU throttling drifts the baud and produces framing errors at 115200. Performance governor locks the clock and stabilizes the UART.

12

Capture a UART-level logic trace. Connect a USB logic analyzer (Saleae Logic 8 or $15 clone) to Pi GPIO14 (TX) and GPIO15 (RX), sample at 1 MHz, decode as serial at 115200 baud 8N1. Record pyminer boot and first ASIC init exchange. A healthy trace shows `55 aa` preamble bytes on TX from Pi, response frames with `aa 55` preamble on RX from BM1366 within ~1 ms. Silent RX = chip unresponsive. Garbled RX = baud drift or noise.

13

Build a custom dtoverlay if you are running a multi-PiAxe farm on a single Pi with UART multiplexing. Copy `/boot/overlays/disable-bt.dtbo` as reference, write a custom overlay that explicitly pins GPIO14/15 to PL011 and enables flow control on GPIO16/17 if you have that wired. Compile with `dtc -@ -I dts -O dtb -o custom-piaxe.dtbo custom-piaxe-overlay.dts`. Install to `/boot/overlays/` and reference in config.txt.

14

Harden the systemd unit against boot-order races. Edit `/etc/systemd/system/pyminer.service`: set `After=network-online.target systemd-udev-settle.service`, `Wants=network-online.target`, `Restart=on-failure`, `RestartSec=10s`. This prevents pyminer from starting before `/dev/serial0` is actually created by udev, a surprisingly common cause of 'works on manual restart but not on boot' reports. `sudo systemctl daemon-reload && sudo systemctl enable pyminer`.

15

Escalate to D-Central's open-source / pleb-mining queue when Tier 1-3 passes every gate but the BM1366 still produces zero RX. We triage PiAxe failures weekly, can confirm whether the ASIC is dead vs whether a subtle config issue remains, and have BM1366 chips in stock for replacement. Email support with: Pi model, OS version, config.txt contents, pyminer log, and logic-trace snippet if you captured one. Half an hour of preparation saves billable bench time.

16

Ship the PiAxe to D-Central for bench work if the chip is suspected dead. Pack in an anti-static bag, double-box with 3 cm of foam on every side. Include a printed note with: Pi model, Raspberry Pi OS version and kernel, `config.txt` contents, last 200 lines of `journalctl -u pyminer`, whether you tried 5V-logic adapters, any known electrical events. Ship to the D-Central address on the Repair Service page.

17

D-Central bench process: visual inspection for burn/cap damage, continuity test on 12V and 3.3V rails, BM1366 response test on a known-good Pi 4 + reference config, chip replacement with graded BM1366 from stock if unresponsive, reflow + reassembly, 4-hour burn-in at target 500 GH/s on solo.ckpool.org. Turnaround 3-7 business days Canada-wide, 5-10 days international. We return the PiAxe with a printed test report.

When to Seek Professional Repair

If the steps above do not resolve the issue, or if you are not comfortable performing these repairs yourself, professional service is recommended. Attempting advanced repairs without proper equipment can cause further damage.

Related Error Codes

Still Having Issues?

Our team of Bitcoin Mining Hackers has been repairing ASIC miners since 2016. We have seen it all and fixed it all. Get a professional diagnosis.