Skip to content

Commit

Permalink
targets/litex_acorn_baseboard_mini: Add detect_ftdi_chip method since…
Browse files Browse the repository at this point in the history
… newer batch of baseboard is mounted with FTDI ft4232 chips.

FT2232 and FT4232 chips are footprint compatible but still need to be handled differently from software.
  • Loading branch information
enjoy-digital committed Jul 19, 2024
1 parent 6d3c87a commit f844d06
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion litex_boards/targets/litex_acorn_baseboard_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Copyright (c) 2021-2024 Florent Kermarrec <[email protected]>
# SPDX-License-Identifier: BSD-2-Clause

import subprocess

from migen import *

from litex.gen import *
Expand Down Expand Up @@ -39,8 +41,18 @@
# Platform -----------------------------------------------------------------------------------------

class Platform(sqrl_acorn.Platform):
def detect_ftdi_chip(self):
lsusb_log = subprocess.run(['lsusb'], capture_output=True, text=True)
for ftdi_chip in ["ft232", "ft2232", "ft4232"]:
if f"Future Technology Devices International, Ltd {ftdi_chip.upper()}" in lsusb_log.stdout:
return ftdi_chip
return None

def create_programmer(self, name="openocd"):
return OpenOCD("openocd_xc7_ft2232.cfg", "bscan_spi_xc7a200t.bit")
ftdi_chip = self.detect_ftdi_chip()
if ftdi_chip is None:
raise RuntimeError("No compatible FTDI device found.")
return OpenOCD(f"openocd_xc7_{ftdi_chip}.cfg", "bscan_spi_xc7a200t.bit")

# CRG ----------------------------------------------------------------------------------------------

Expand Down

0 comments on commit f844d06

Please sign in to comment.