From 0ba8045789edd941ac4e067b6d9f015e402ed66b Mon Sep 17 00:00:00 2001 From: Ilya Epifanov Date: Tue, 28 Apr 2020 21:56:33 +0200 Subject: [PATCH] Added spiflash1x pins, a method to create an SpiFlash instance and a note on a second UART channel of FT2232H --- litex_boards/platforms/ecp5_evn.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/litex_boards/platforms/ecp5_evn.py b/litex_boards/platforms/ecp5_evn.py index 8d25719..83c759a 100644 --- a/litex_boards/platforms/ecp5_evn.py +++ b/litex_boards/platforms/ecp5_evn.py @@ -4,6 +4,7 @@ from litex.build.generic_platform import * from litex.build.lattice import LatticePlatform from litex.build.lattice.programmer import OpenOCDJTAGProgrammer +from litex.soc.cores.spi_flash import SpiFlash import os @@ -43,6 +44,14 @@ _io = [ Subsignal("dq", Pins("W2 V2 Y2 W1"), IOStandard("LVCMOS33")), ), + ("spiflash1x", 0, + Subsignal("cs_n", Pins("R2"), IOStandard("LVCMOS33")), + Subsignal("mosi", Pins("W2"), IOStandard("LVCMOS33")), + Subsignal("miso", Pins("V2"), IOStandard("LVCMOS33")), + Subsignal("wp", Pins("Y2"), IOStandard("LVCMOS33")), + Subsignal("hold", Pins("W1"), IOStandard("LVCMOS33")), + ), + ("clk200", 0, Subsignal("p", Pins("Y19")), Subsignal("n", Pins("W20")), @@ -125,11 +134,20 @@ class Platform(LatticePlatform): def __init__(self, **kwargs): LatticePlatform.__init__(self, "LFE5UM5G-85F-8BG381", _io, _connectors, **kwargs) + def make_spiflash(self): + flash_pads = self.request("spiflash1x") + + spiflash = SpiFlash(flash_pads, endianness="little", div=2, dummy=8) + spiflash.add_clk_primitive(self.device) + return spiflash + def request(self, *args, **kwargs): if "serial" in args: print("R22 and R23 should be removed, two 0 Ω resistors shoud be " "populated on R34 and R35 and the FT2232H should be configured to " "UART with virtual COM on port B") + print("Make sure your on-board FT2232H can properly talk UART.") + print("Follow instructions here: https://github.com/trabucayre/fixFT2232_ecp5evn") if "ext_clk50" in args: print("an oscillator must be populated on X5")