trellisboard: Add PMOD GPIO support (for tests with MicroPython).
This commit is contained in:
parent
9e18d9bc34
commit
2b2c7d3d68
|
@ -229,6 +229,9 @@ _connectors = [
|
||||||
|
|
||||||
# PMODS --------------------------------------------------------------------------------------------
|
# PMODS --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def raw_pmod_io(pmod):
|
||||||
|
return [(pmod, 0, Pins(" ".join([f"{pmod}:{i:d}" for i in range(8)])), IOStandard("LVCMOS33"))]
|
||||||
|
|
||||||
def sdcard_pmod_io(pmod):
|
def sdcard_pmod_io(pmod):
|
||||||
return [
|
return [
|
||||||
# SDCard PMOD:
|
# SDCard PMOD:
|
||||||
|
|
|
@ -20,6 +20,7 @@ from litex.soc.cores.clock import *
|
||||||
from litex.soc.integration.soc_core import *
|
from litex.soc.integration.soc_core import *
|
||||||
from litex.soc.integration.builder import *
|
from litex.soc.integration.builder import *
|
||||||
from litex.soc.cores.led import LedChaser
|
from litex.soc.cores.led import LedChaser
|
||||||
|
from litex.soc.cores.gpio import GPIOTristate
|
||||||
|
|
||||||
from litedram.modules import MT41J256M16
|
from litedram.modules import MT41J256M16
|
||||||
from litedram.phy import ECP5DDRPHY
|
from litedram.phy import ECP5DDRPHY
|
||||||
|
@ -112,7 +113,7 @@ class _CRGSDRAM(Module):
|
||||||
|
|
||||||
class BaseSoC(SoCCore):
|
class BaseSoC(SoCCore):
|
||||||
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", with_ethernet=False,
|
def __init__(self, sys_clk_freq=int(75e6), toolchain="trellis", with_ethernet=False,
|
||||||
with_led_chaser=True, **kwargs):
|
with_led_chaser=True, with_pmod_gpio=False, **kwargs):
|
||||||
platform = trellisboard.Platform(toolchain=toolchain)
|
platform = trellisboard.Platform(toolchain=toolchain)
|
||||||
|
|
||||||
# SoCCore ----------------------------------------------------------------------------------
|
# SoCCore ----------------------------------------------------------------------------------
|
||||||
|
@ -135,7 +136,7 @@ class BaseSoC(SoCCore):
|
||||||
self.add_sdram("sdram",
|
self.add_sdram("sdram",
|
||||||
phy = self.ddrphy,
|
phy = self.ddrphy,
|
||||||
module = MT41J256M16(sys_clk_freq, "1:2"),
|
module = MT41J256M16(sys_clk_freq, "1:2"),
|
||||||
l2_cache_size = kwargs.get("l2_size", 8192)
|
l2_cache_size = kwargs.get("l2_size", 8192),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ethernet ---------------------------------------------------------------------------------
|
# Ethernet ---------------------------------------------------------------------------------
|
||||||
|
@ -151,6 +152,11 @@ class BaseSoC(SoCCore):
|
||||||
pads = platform.request_all("user_led"),
|
pads = platform.request_all("user_led"),
|
||||||
sys_clk_freq = sys_clk_freq)
|
sys_clk_freq = sys_clk_freq)
|
||||||
|
|
||||||
|
# GPIOs ------------------------------------------------------------------------------------
|
||||||
|
if with_pmod_gpio:
|
||||||
|
platform.add_extension(trellisboard.raw_pmod_io("pmoda"))
|
||||||
|
self.submodules.gpio = GPIOTristate(platform.request("pmoda"))
|
||||||
|
|
||||||
# Build --------------------------------------------------------------------------------------------
|
# Build --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -163,6 +169,7 @@ def main():
|
||||||
sdopts = parser.add_mutually_exclusive_group()
|
sdopts = parser.add_mutually_exclusive_group()
|
||||||
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support")
|
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support")
|
||||||
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support")
|
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support")
|
||||||
|
parser.add_argument("--with-pmod-gpio", action="store_true", help="Enable GPIOs through PMOD") # FIXME: Temporary test.
|
||||||
builder_args(parser)
|
builder_args(parser)
|
||||||
soc_core_args(parser)
|
soc_core_args(parser)
|
||||||
trellis_args(parser)
|
trellis_args(parser)
|
||||||
|
@ -171,6 +178,7 @@ def main():
|
||||||
soc = BaseSoC(
|
soc = BaseSoC(
|
||||||
sys_clk_freq = int(float(args.sys_clk_freq)),
|
sys_clk_freq = int(float(args.sys_clk_freq)),
|
||||||
with_ethernet = args.with_ethernet,
|
with_ethernet = args.with_ethernet,
|
||||||
|
with_pmod_gpio = args.with_pmod_gpio,
|
||||||
**soc_core_argdict(args)
|
**soc_core_argdict(args)
|
||||||
)
|
)
|
||||||
if args.with_spi_sdcard:
|
if args.with_spi_sdcard:
|
||||||
|
|
Loading…
Reference in New Issue