forked from M-Labs/humpback-dds
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)
|
# 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
|
# Define I2C interface
|
||||||
# TODO: Make it optional, declare it in a block itself
|
# TODO: Make it optional, declare it in a block itself
|
||||||
# Use "role=device" to make humpback a I2C slave
|
# Use "role=device" to make humpback a I2C slave
|
||||||
|
@ -64,7 +55,6 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||||
]
|
]
|
||||||
|
|
||||||
# Using the dict approach in (o)migen
|
# Using the dict approach in (o)migen
|
||||||
# Note: Numbering is required in nMigen, so some probably not very meaningful strings/integers are inserted
|
|
||||||
connectors = [
|
connectors = [
|
||||||
|
|
||||||
# EEM0 Connector
|
# EEM0 Connector
|
||||||
|
@ -129,7 +119,7 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||||
|
|
||||||
# STM32 Nucleo/ Arduino Connector
|
# STM32 Nucleo/ Arduino Connector
|
||||||
# TODO: Suspect SPI mismatch forever
|
# TODO: Suspect SPI mismatch forever
|
||||||
Connector("stm32", "pins", {
|
Connector("stm32", 0, {
|
||||||
"PA0": "A2",
|
"PA0": "A2",
|
||||||
# "PA1": "P14", # PA1 -> PB2, but PB2 has a mapping on FPGA already
|
# "PA1": "P14", # PA1 -> PB2, but PB2 has a mapping on FPGA already
|
||||||
# "PA2": "B8", # PA2 -> PF6
|
# "PA2": "B8", # PA2 -> PF6
|
||||||
|
@ -228,7 +218,7 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||||
}),
|
}),
|
||||||
|
|
||||||
# Beaglebone Black Connector
|
# Beaglebone Black Connector
|
||||||
Connector("bb", "pins", {
|
Connector("bb", 0, {
|
||||||
"CLKOUT": "R9",
|
"CLKOUT": "R9",
|
||||||
|
|
||||||
"GPIO0_7": "R14",
|
"GPIO0_7": "R14",
|
||||||
|
@ -281,7 +271,7 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||||
}),
|
}),
|
||||||
|
|
||||||
# ESP32 Connector
|
# ESP32 Connector
|
||||||
Connector("esp32", "pins", {
|
Connector("esp32", 0, {
|
||||||
"IO2": "D9",
|
"IO2": "D9",
|
||||||
"IO4": "D7",
|
"IO4": "D7",
|
||||||
"IO22": "C7",
|
"IO22": "C7",
|
||||||
|
@ -290,11 +280,12 @@ class HumpbackPlatform(LatticeICE40Platform):
|
||||||
}),
|
}),
|
||||||
|
|
||||||
# OrangePI Zero Connector
|
# OrangePI Zero Connector
|
||||||
Connector("orange_pi", "pins", {
|
Connector("orange_pi", 0, {
|
||||||
"PG06": "A15",
|
"PG06": "A15",
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Half completed, second EEM resource to be added
|
||||||
eem_to_urukul = [
|
eem_to_urukul = [
|
||||||
Resource("eem", 1,
|
Resource("eem", 1,
|
||||||
Subsignal("sclk", DiffPairs("L6", "L3", dir="o", conn=("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
|
# tool chain setup, using default ICE40 HX8K evaluation code
|
||||||
def toolchain_program(self, products, name):
|
def toolchain_program(self, products, name):
|
||||||
iceprog = os.environ.get("ICEPROG", "iceprog")
|
iceprog = os.environ.get("ICEPROG", "iceprog")
|
||||||
|
@ -318,5 +320,6 @@ if __name__ == "__main__":
|
||||||
from nmigen_boards.test.blinky import *
|
from nmigen_boards.test.blinky import *
|
||||||
platform = HumpbackPlatform()
|
platform = HumpbackPlatform()
|
||||||
platform.add_resources(platform.eem_to_urukul)
|
platform.add_resources(platform.eem_to_urukul)
|
||||||
|
platform.add_resources(platform.spi)
|
||||||
platform.build(Blinky(), do_program=False)
|
platform.build(Blinky(), do_program=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue