humpback: added SPI
This commit is contained in:
parent
04faa5da95
commit
37d960669a
@ -45,15 +45,6 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
# attrs=Attrs(IO_STANDARD="SB_LVCMOS", PULLUP=1)
|
||||
# ),
|
||||
|
||||
# Define SPI interfaces
|
||||
# TODO; Make it optional, define it in a block
|
||||
# Note: Use "role=device" to make humpback a SPI slave
|
||||
# The ~CS pin is a global pin, but not being configured global.
|
||||
SPIResource(0,
|
||||
cs="R2", clk="C8", mosi="N5", miso="T2",
|
||||
attrs=Attrs(IO_STANDARD="SB_LVCMOS")
|
||||
),
|
||||
|
||||
# Define I2C interface
|
||||
# TODO: Make it optional, declare it in a block itself
|
||||
# Use "role=device" to make humpback a I2C slave
|
||||
@ -64,7 +55,6 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
]
|
||||
|
||||
# Using the dict approach in (o)migen
|
||||
# Note: Numbering is required in nMigen, so some probably not very meaningful strings/integers are inserted
|
||||
connectors = [
|
||||
|
||||
# EEM0 Connector
|
||||
@ -91,45 +81,45 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
Connector("eem", 1, {
|
||||
"d0_cc_n": "L3",
|
||||
"d0_cc_p": "L6",
|
||||
"d1_n": "F1",
|
||||
"d1_p": "H6",
|
||||
"d2_n": "G2",
|
||||
"d2_p": "H4",
|
||||
"d3_n": "H2",
|
||||
"d3_p": "J4",
|
||||
"d4_n": "J1",
|
||||
"d4_p": "J2",
|
||||
"d5_n": "K3",
|
||||
"d5_p": "K1",
|
||||
"d6_n": "L1",
|
||||
"d6_p": "L4",
|
||||
"d7_n": "M1",
|
||||
"d7_p": "K4",
|
||||
"d1_n" : "F1",
|
||||
"d1_p" : "H6",
|
||||
"d2_n" : "G2",
|
||||
"d2_p" : "H4",
|
||||
"d3_n" : "H2",
|
||||
"d3_p" : "J4",
|
||||
"d4_n" : "J1",
|
||||
"d4_p" : "J2",
|
||||
"d5_n" : "K3",
|
||||
"d5_p" : "K1",
|
||||
"d6_n" : "L1",
|
||||
"d6_p" : "L4",
|
||||
"d7_n" : "M1",
|
||||
"d7_p" : "K4",
|
||||
}),
|
||||
|
||||
# EEM2 Connector
|
||||
Connector("eem", 2, {
|
||||
"d0_cc_n": "G1",
|
||||
"d0_cc_p": "J5",
|
||||
"d1_n": "M2",
|
||||
"d1_p": "K5",
|
||||
"d2_n": "N2",
|
||||
"d2_p": "L7",
|
||||
"d3_n": "M3",
|
||||
"d3_p": "M6",
|
||||
"d4_n": "N3",
|
||||
"d4_p": "L5",
|
||||
"d5_n": "M4",
|
||||
"d5_p": "P1",
|
||||
"d6_n": "M5",
|
||||
"d6_p": "P2",
|
||||
"d7_n": "N4",
|
||||
"d7_p": "R1",
|
||||
"d1_n" : "M2",
|
||||
"d1_p" : "K5",
|
||||
"d2_n" : "N2",
|
||||
"d2_p" : "L7",
|
||||
"d3_n" : "M3",
|
||||
"d3_p" : "M6",
|
||||
"d4_n" : "N3",
|
||||
"d4_p" : "L5",
|
||||
"d5_n" : "M4",
|
||||
"d5_p" : "P1",
|
||||
"d6_n" : "M5",
|
||||
"d6_p" : "P2",
|
||||
"d7_n" : "N4",
|
||||
"d7_p" : "R1",
|
||||
}),
|
||||
|
||||
# STM32 Nucleo/ Arduino Connector
|
||||
# TODO: Suspect SPI mismatch forever
|
||||
Connector("stm32", "pins", {
|
||||
Connector("stm32", 0, {
|
||||
"PA0": "A2",
|
||||
# "PA1": "P14", # PA1 -> PB2, but PB2 has a mapping on FPGA already
|
||||
# "PA2": "B8", # PA2 -> PF6
|
||||
@ -228,7 +218,7 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
}),
|
||||
|
||||
# Beaglebone Black Connector
|
||||
Connector("bb", "pins", {
|
||||
Connector("bb", 0, {
|
||||
"CLKOUT": "R9",
|
||||
|
||||
"GPIO0_7": "R14",
|
||||
@ -281,7 +271,7 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
}),
|
||||
|
||||
# ESP32 Connector
|
||||
Connector("esp32", "pins", {
|
||||
Connector("esp32", 0, {
|
||||
"IO2": "D9",
|
||||
"IO4": "D7",
|
||||
"IO22": "C7",
|
||||
@ -290,11 +280,12 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
}),
|
||||
|
||||
# OrangePI Zero Connector
|
||||
Connector("orange_pi", "pins", {
|
||||
Connector("orange_pi", 0, {
|
||||
"PG06": "A15",
|
||||
}),
|
||||
]
|
||||
|
||||
# Half completed, second EEM resource to be added
|
||||
eem_to_urukul = [
|
||||
Resource("eem", 1,
|
||||
Subsignal("sclk", DiffPairs("L6", "L3", dir="o", conn=("eem", 1))),
|
||||
@ -308,6 +299,17 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||
)
|
||||
]
|
||||
|
||||
# SPI Connection
|
||||
spi = [
|
||||
Resource("spi", 0,
|
||||
Subsignal("cs", PinsN("R2", dir="i", conn=("stm32", 0))),
|
||||
Subsignal("mosi", Pins("N5", dir="i", conn=("stm32", 0))),
|
||||
Subsignal("miso", Pins("T2", dir="oe", conn=("stm32", 0))),
|
||||
Subsignal("sck", Pins("C8", dir="i", conn=("stn32", 0))),
|
||||
Attrs(IO_STANDARD="SB_LVCMOS")
|
||||
)
|
||||
]
|
||||
|
||||
# tool chain setup, using default ICE40 HX8K evaluation code
|
||||
def toolchain_program(self, products, name):
|
||||
iceprog = os.environ.get("ICEPROG", "iceprog")
|
||||
@ -318,5 +320,6 @@ if __name__ == "__main__":
|
||||
from nmigen_boards.test.blinky import *
|
||||
platform = HumpbackPlatform()
|
||||
platform.add_resources(platform.eem_to_urukul)
|
||||
platform.add_resources(platform.spi)
|
||||
platform.build(Blinky(), do_program=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user