Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Build HAT library to work on Raspberry Pi 5 #203

Merged
merged 1 commit into from
Nov 23, 2023
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
Loading