From 265c52bc2ac5496f5fa96327025256ae5740da07 Mon Sep 17 00:00:00 2001 From: newell Date: Thu, 14 Nov 2024 11:55:37 -0800 Subject: [PATCH 1/2] Add default TTLs to EBAZ4205 --- examples/ebaz4205/device_db.py | 10 +++++++++- src/gateware/ebaz4205.py | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/examples/ebaz4205/device_db.py b/examples/ebaz4205/device_db.py index a3f4420..59cb362 100644 --- a/examples/ebaz4205/device_db.py +++ b/examples/ebaz4205/device_db.py @@ -53,13 +53,21 @@ device_db = { }, } +# TTLs starting at RTIO channel 2, ending at RTIO channel 15 +for i in range(2, 16): + device_db["ttl" + str(i)] = { + "type": "local", + "module": "artiq.coredevice.ttl", + "class": "TTLInOut", + "arguments": {"channel": i}, + } device_db.update( spi0={ "type": "local", "module": "artiq.coredevice.spi2", "class": "SPIMaster", - "arguments": {"channel": 2}, + "arguments": {"channel": 16}, }, dds0={ "type": "local", diff --git a/src/gateware/ebaz4205.py b/src/gateware/ebaz4205.py index efd0d11..bc593c9 100644 --- a/src/gateware/ebaz4205.py +++ b/src/gateware/ebaz4205.py @@ -91,6 +91,17 @@ _spi = [ ] +# Connector DATA1 +def _create_ttl(): + _ttl = [] + + for idx, elem in enumerate([x for x in range(5, 21) if x not in (10, 12)]): + _ttl.append( + ("ttl", idx, Pins("DATA1:DATA1-{}".format(elem)), IOStandard("LVCMOS33")), + ) + return _ttl + + class EBAZ4205(SoCCore): def __init__(self, rtio_clk=125e6, acpki=False): self.acpki = acpki @@ -105,6 +116,7 @@ class EBAZ4205(SoCCore): platform.add_extension(_ddr) platform.add_extension(_i2c) platform.add_extension(_spi) + platform.add_extension(_create_ttl()) gmii = platform.request("gmii") platform.add_period_constraint(gmii.rx_clk, 10) @@ -180,6 +192,13 @@ class EBAZ4205(SoCCore): self.submodules += phy self.rtio_channels.append(rtio.Channel.from_phy(phy)) + for i in range(14): + print("TTL at RTIO channel 0x{:06x}".format(len(self.rtio_channels))) + ttl = self.platform.request("ttl", i) + phy = ttl_simple.Output(ttl) + self.submodules += phy + self.rtio_channels.append(rtio.Channel.from_phy(phy)) + print("SPI at RTIO channel 0x{:06x}".format(len(self.rtio_channels))) spi_phy = spi2.SPIMaster(platform.request("spi")) self.submodules += spi_phy -- 2.47.0 From 3f2d111abbfc57ff83d93a468bfecf9105c1441f Mon Sep 17 00:00:00 2001 From: newell Date: Thu, 14 Nov 2024 13:24:56 -0800 Subject: [PATCH 2/2] Make TTLs InOut in gateware --- src/gateware/ebaz4205.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gateware/ebaz4205.py b/src/gateware/ebaz4205.py index bc593c9..d64d2e1 100644 --- a/src/gateware/ebaz4205.py +++ b/src/gateware/ebaz4205.py @@ -5,7 +5,7 @@ import argparse import analyzer import dma from artiq.gateware import rtio -from artiq.gateware.rtio.phy import dds, spi2, ttl_simple +from artiq.gateware.rtio.phy import spi2, ttl_simple from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path from config import write_csr_file, write_mem_file, write_rustc_cfg_file from migen import * @@ -195,7 +195,7 @@ class EBAZ4205(SoCCore): for i in range(14): print("TTL at RTIO channel 0x{:06x}".format(len(self.rtio_channels))) ttl = self.platform.request("ttl", i) - phy = ttl_simple.Output(ttl) + phy = ttl_simple.InOut(ttl) self.submodules += phy self.rtio_channels.append(rtio.Channel.from_phy(phy)) -- 2.47.0