Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions buildhat/serinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile
import threading
import time
import os
from enum import Enum
from threading import Condition, Timer

Expand Down Expand Up @@ -105,6 +106,11 @@ def __init__(self, firmware, signature, version, device="/dev/serial0", debug=Fa
self.rampftr.append([])
self.motorqueue.append(queue.Queue())

# On a Pi 5 /dev/serial0 will point to /dev/ttyAMA10 (which *only*
# exists on a Pi 5, and is the 3-pin debug UART connector)
# The UART on the Pi 5 GPIO header is /dev/ttyAMA0
if device == "/dev/serial0" and os.readlink(device) == "ttyAMA10":
device = "/dev/ttyAMA0"
self.ser = serial.Serial(device, 115200, timeout=5)
# Check if we're in the bootloader or the firmware
self.write(b"version\r")
Expand Down