From 0f6bc29c023d363c49cdaaf2f2090719f056c88d Mon Sep 17 00:00:00 2001 From: x44203 <60701660+x44203@users.noreply.github.com> Date: Wed, 5 Feb 2020 23:00:19 +0100 Subject: [PATCH 1/2] Update ecp5_5g_evn.py Added connectors and some resources --- nmigen_boards/ecp5_5g_evn.py | 44 +++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/nmigen_boards/ecp5_5g_evn.py b/nmigen_boards/ecp5_5g_evn.py index b38e3ae..911a2f2 100644 --- a/nmigen_boards/ecp5_5g_evn.py +++ b/nmigen_boards/ecp5_5g_evn.py @@ -19,16 +19,47 @@ class ECP55GEVNPlatform(LatticeECP5Platform): Resource("rst", 0, PinsN("G2", dir="i"), Attrs(IO_TYPE="LVCMOS33")), Resource("clk12", 0, Pins("A10", dir="i"), Clock(12e6), Attrs(IO_TYPE="LVCMOS33")), - - *LEDResources(pins="A13 A12 B19 A18 B18 C17 A17 B17", - attrs=Attrs(IO_TYPE="LVCMOS33")), - *SwitchResources(pins="P4", invert=True, + Resource("clk200", 0, DiffPairs("Y19", "W20", dir="i"), + Clock(2e8), Attrs(IO_TYPE="LVDS")), + + # The switches and LEDs are connected over resistors to VCCIO6 for SW4 and SW5 switch 1-3 and VCCIO1 for the LEDs and SW5 switch 4-8. + # VCCIO1 is connected by default to 2.5 V over R100 (can be set to 3.3 V by disconnecting R100 and connecting R105) + # VCCIO6 is connected to 3.3 V by default over R99 (can be switched to 2.5 V with R104, see page 51 in the ECP5 evaluation board datasheet) + *LEDResources(pins="A13 A12 B19 A18 B18 C17 A17 B17", invert=True, + attrs=Attrs(IO_TYPE="LVCMOS25")), + *ButtonResources(pins="P4", invert=True, attrs=Attrs(IO_TYPE="LVCMOS33")), - + *SwitchResources(pins={1: "J1", 2: "H1", 3: "K1"}, invert=True, + attrs=Attrs(IO_TYPE="LVCMOS33")), + *SwitchResources(pins={4: "E15", 5: "D16", 6: "B16", 7: "C16", 8: "A16"}, invert=True, + attrs=Attrs(IO_TYPE="LVCMOS25")), # TODO: add other resources ] connectors = [ - # TODO: add connectors + Connector("J", 39, "- - - D15 B15 C15 B13 B20 D11 E11 B12 C12 D12 E12 C13 D13 E13 A14 A9 B10 - - - - - - - - E7 - A11 - A19 - - - - - - -"), + Connector("J", 40, "K2 - A15 F1 H2 G1 J4 J5 J3 K3 L4 L5 M4 N5 N4 P5 N3 M3 - - K5 - M5 - L3 - N2 M1 L2 - L1 N1 C14 - P1 E14 D14 - K4 -"), + # Arduino + Connector("J", 6, "K16 J16 H17 J17 H18 H16 - G18 G16 F17"), + Connector("J", 3, "F19 F20 E20 E19 D19 D20 C20 K17"), + Connector("J", 7, "C18 - D17 - - - - -"), + Connector("J", 4, "F18 E17 E18 D18 F16 E16"), + # Raspberry Pi + Connector("JP", 8, "- - T17 - U16 - U17 P18 - N20 N19 T16 M18 - N17 P17 - M17 U20 - T19 N18 R20 U19 - R18 L18 L17 U18 - T18 T20 P20 - R17 P19 N16 P16 - R16"), + # GPIO + Connector("J", 5, "- - H20 G19 - - K18 J18 - - K19 J10 - - K20 J20 - - G20 - - -"), # Contains 4 differential pairs + Connector("J", 8, "- - L19 M19 L20 M20 L16 -"), + # Diff pairs, they don't have termination resistors. Add them yourself, on the top side near the FPGA R56-R72 + Connector("J", 32, "- - - - A5 A4 - - C5 B5 - - B4 C4 - - B3 A3 - - D5 E4 - - D3 C3 - - E3 F4 - - F5 E5 - - B1 A2 - -"), # Contains 9 differential pairs + Connector("J", 33, "- - - - C2 B2 - - D1 C1 - - E1 D2 - - G5 H4 - - H3 H5 - - F3 G3 - - E2 F2 - -"), # Contains 7 differential pairs + # Mic + Connector("J", 30, "- B6 D9 C9 E9 D10 A6 E10 - -"), + # PMOD + Connector("J", 31, "C6 C7 E8 D8 - - C8 B8 A7 A8 - -"), + # JTAG + Connector("J", 1, "- V4 R5 - - U5 - T5"), + # Parallel configuration + Connector("J", 38, "W3 R2 T3 Y3 R1 V3 T1 V2 U1 W2 V1 T2 W1 U2 Y2 R2 U3 R3 - -"), # Connect pin 2 / R2 with jumper when needed + # TODO: Check for correctness ] @property @@ -61,3 +92,4 @@ def toolchain_program(self, products, name): if __name__ == "__main__": from .test.blinky import * ECP55GEVNPlatform().build(Blinky(), do_program=True) + From 71a837056a7f444367630844aae52183f1e609bd Mon Sep 17 00:00:00 2001 From: x44203 <60701660+x44203@users.noreply.github.com> Date: Wed, 5 Feb 2020 23:02:11 +0100 Subject: [PATCH 2/2] Update blinky.py Support for leds, buttons and switches starting at 1 --- nmigen_boards/test/blinky.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nmigen_boards/test/blinky.py b/nmigen_boards/test/blinky.py index 460fb0a..d742187 100644 --- a/nmigen_boards/test/blinky.py +++ b/nmigen_boards/test/blinky.py @@ -17,7 +17,8 @@ def get_all_resources(name): try: resources.append(platform.request(name, number)) except ResourceError: - break + if number > 0: + break return resources leds = [res.o for res in get_all_resources("led")]