sipeed_tang_primer_20k: Add LedChaser through 204 pin SODIMM connector/Dock.

This commit is contained in:
Florent Kermarrec 2022-07-26 11:44:03 +02:00
parent d49e43801e
commit 12b8063941
2 changed files with 31 additions and 8 deletions

View file

@ -51,10 +51,12 @@ _io = [
), ),
] ]
# 204 Pins SODIMM Connector ------------------------------------------------------------------------ # Dock 204 Pins SODIMM Connector -------------------------------------------------------------------
_connectors = [ _connectors = [
["CARD1A", ["CARD1",
# A.
# -------------------------------------------------
"---", # 0 "---", # 0
# GND GND 5V 5V 5V 5V GND GND NC ( 1-10). # GND GND 5V 5V 5V 5V GND GND NC ( 1-10).
" T13 --- --- --- --- --- --- --- --- ---", " T13 --- --- --- --- --- --- --- --- ---",
@ -72,9 +74,8 @@ _connectors = [
" --- H16 R12 H14 P13 --- R13 G16 T14 H15", " --- H16 R12 H14 P13 --- R13 G16 T14 H15",
# GND GND (71-72). # GND GND (71-72).
" --- ---", " --- ---",
], # B.
["CARD1B", # -------------------------------------------------
"---", # 0
# NC (73-82). # NC (73-82).
" M15 L13 M14 K11 F13 K12 G12 K13 T15 ---", " M15 L13 M14 K11 F13 K12 G12 K13 T15 ---",
# NC NC (83-92). # NC NC (83-92).
@ -106,6 +107,18 @@ _connectors = [
], ],
] ]
# Dock IOs -----------------------------------------------------------------------------------------
_dock_io = [
# Leds
("user_led", 0, Pins( "CARD1:44"), IOStandard("LVCMOS33")),
("user_led", 1, Pins( "CARD1:46"), IOStandard("LVCMOS33")),
("user_led", 3, Pins( "CARD1:40"), IOStandard("LVCMOS33")),
("user_led", 2, Pins( "CARD1:42"), IOStandard("LVCMOS33")),
("user_led", 4, Pins( "CARD1:98"), IOStandard("LVCMOS33")),
("user_led", 5, Pins("CARD1:136"), IOStandard("LVCMOS33")),
]
# Platform ----------------------------------------------------------------------------------------- # Platform -----------------------------------------------------------------------------------------
class Platform(GowinPlatform): class Platform(GowinPlatform):
@ -114,8 +127,11 @@ class Platform(GowinPlatform):
def __init__(self, toolchain="gowin"): def __init__(self, toolchain="gowin"):
GowinPlatform.__init__(self, "GW2A-LV18PG256C8/I7", _io, _connectors, toolchain=toolchain, devicename="GW2A-18C") GowinPlatform.__init__(self, "GW2A-LV18PG256C8/I7", _io, _connectors, toolchain=toolchain, devicename="GW2A-18C")
self.toolchain.options["use_mspi_as_gpio"] = 1 self.add_extension(_dock_io)
self.toolchain.options["use_sspi_as_gpio"] = 1 self.toolchain.options["use_mspi_as_gpio"] = 1
self.toolchain.options["use_sspi_as_gpio"] = 1
self.toolchain.options["use_ready_as_gpio"] = 1
self.toolchain.options["use_done_as_gpio"] = 1
def create_programmer(self, kit="openfpgaloader"): def create_programmer(self, kit="openfpgaloader"):
return OpenFPGALoader(cable="ft2232") return OpenFPGALoader(cable="ft2232")

View file

@ -51,7 +51,7 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(48e6), with_spi_flash=False, **kwargs): def __init__(self, sys_clk_freq=int(48e6), with_spi_flash=False, with_led_chaser=True, **kwargs):
platform = sipeed_tang_primer_20k.Platform() platform = sipeed_tang_primer_20k.Platform()
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
@ -66,6 +66,13 @@ class BaseSoC(SoCCore):
from litespi.opcodes import SpiNorFlashOpCodes as Codes from litespi.opcodes import SpiNorFlashOpCodes as Codes
self.add_spi_flash(mode="1x", module=SpiFlashModule(Codes.READ_1_1_1)) self.add_spi_flash(mode="1x", module=SpiFlashModule(Codes.READ_1_1_1))
# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.submodules.leds = LedChaser(
pads = platform.request_all("user_led"),
sys_clk_freq = sys_clk_freq
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------
def main(): def main():