mirror of
https://github.com/litex-hub/litex-boards.git
synced 2025-01-03 03:43:36 -05:00
sipeed_tang_primer_20k: Add buttons and prepare RGB Led.
Synthesis issue with WS2812/GowinEDA for now.
This commit is contained in:
parent
09b0c975f3
commit
f2cb211432
2 changed files with 57 additions and 23 deletions
|
@ -111,14 +111,24 @@ _connectors = [
|
|||
|
||||
_dock_io = [
|
||||
# Leds
|
||||
("user_led", 0, Pins( "CARD1:44"), IOStandard("LVCMOS18")),
|
||||
("user_led", 1, Pins( "CARD1:46"), IOStandard("LVCMOS18")),
|
||||
("user_led", 3, Pins( "CARD1:40"), IOStandard("LVCMOS18")),
|
||||
("user_led", 2, Pins( "CARD1:42"), IOStandard("LVCMOS18")),
|
||||
("user_led", 4, Pins( "CARD1:98"), IOStandard("LVCMOS18")),
|
||||
("user_led", 5, Pins("CARD1:136"), IOStandard("LVCMOS18")),
|
||||
("led", 0, Pins( "CARD1:44"), IOStandard("LVCMOS18")),
|
||||
("led", 1, Pins( "CARD1:46"), IOStandard("LVCMOS18")),
|
||||
("led", 3, Pins( "CARD1:40"), IOStandard("LVCMOS18")),
|
||||
("led", 2, Pins( "CARD1:42"), IOStandard("LVCMOS18")),
|
||||
("led", 4, Pins( "CARD1:98"), IOStandard("LVCMOS18")),
|
||||
("led", 5, Pins("CARD1:136"), IOStandard("LVCMOS18")),
|
||||
|
||||
# HDMI
|
||||
# RGB Led.
|
||||
("rgb_led", 0, Pins("CARD1:45"), IOStandard("LVCMOS18")),
|
||||
|
||||
# Buttons.
|
||||
("btn_n", 0, Pins( "CARD1:15"), IOStandard("LVCMOS18")),
|
||||
("btn_n", 1, Pins("CARD1:165"), IOStandard("LVCMOS15")),
|
||||
("btn_n", 2, Pins("CARD1:163"), IOStandard("LVCMOS15")),
|
||||
("btn_n", 3, Pins("CARD1:159"), IOStandard("LVCMOS15")),
|
||||
("btn_n", 4, Pins("CARD1:157"), IOStandard("LVCMOS15")),
|
||||
|
||||
# HDMI.
|
||||
("hdmi", 0,
|
||||
Subsignal("clk_p", Pins("CARD1:132")),
|
||||
Subsignal("clk_n", Pins("CARD1:130")),
|
||||
|
@ -167,6 +177,7 @@ class Platform(GowinPlatform):
|
|||
self.toolchain.options["use_sspi_as_gpio"] = 1
|
||||
self.toolchain.options["use_ready_as_gpio"] = 1
|
||||
self.toolchain.options["use_done_as_gpio"] = 1
|
||||
self.toolchain.options["rw_check_on_ram"] = 1
|
||||
|
||||
def create_programmer(self, kit="openfpgaloader"):
|
||||
return OpenFPGALoader(cable="ft2232")
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
# This file is part of LiteX-Boards.
|
||||
#
|
||||
# Copyright (c) 2022 Icenowy Zheng <icenowy@aosc.io>
|
||||
# Copyright (c) 2022 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
from migen import *
|
||||
|
@ -13,7 +14,8 @@ from litex.soc.cores.clock.gowin_gw2a import GW2APLL
|
|||
from litex.soc.integration.soc_core import *
|
||||
from litex.soc.integration.soc import SoCRegion
|
||||
from litex.soc.integration.builder import *
|
||||
from litex.soc.cores.led import LedChaser
|
||||
from litex.soc.cores.led import LedChaser, WS2812
|
||||
from litex.soc.cores.gpio import GPIOIn
|
||||
from litex.soc.cores.video import *
|
||||
|
||||
from liteeth.phy.rmii import LiteEthPHYRMII
|
||||
|
@ -67,7 +69,11 @@ class _CRG(Module):
|
|||
# BaseSoC ------------------------------------------------------------------------------------------
|
||||
|
||||
class BaseSoC(SoCCore):
|
||||
def __init__(self, sys_clk_freq=int(48e6), with_spi_flash=False, with_led_chaser=True,
|
||||
def __init__(self, sys_clk_freq=int(48e6),
|
||||
with_spi_flash = False,
|
||||
with_led_chaser = True,
|
||||
with_rgb_led = False,
|
||||
with_buttons = True,
|
||||
with_video_terminal = False,
|
||||
with_ethernet = False,
|
||||
with_etherbone = False,
|
||||
|
@ -88,20 +94,6 @@ class BaseSoC(SoCCore):
|
|||
from litespi.opcodes import SpiNorFlashOpCodes as Codes
|
||||
self.add_spi_flash(mode="1x", module=SpiFlashModule(Codes.READ_1_1_1))
|
||||
|
||||
# Video ------------------------------------------------------------------------------------
|
||||
if with_video_terminal:
|
||||
# FIXME: Un-tested.
|
||||
self.submodules.videophy = VideoHDMIPHY(platform.request("hdmi"), clock_domain="hdmi", pn_swap=["r", "g", "b"])
|
||||
self.add_video_colorbars(phy=self.videophy, timings="640x480@60Hz", clock_domain="hdmi")
|
||||
#self.add_video_terminal(phy=self.videophy, timings="640x480@75Hz", clock_domain="hdmi")
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
self.submodules.leds = LedChaser(
|
||||
pads = platform.request_all("user_led"),
|
||||
sys_clk_freq = sys_clk_freq
|
||||
)
|
||||
|
||||
# Ethernet / Etherbone ---------------------------------------------------------------------
|
||||
if with_ethernet or with_etherbone:
|
||||
# FIXME: Un-tested.
|
||||
|
@ -116,6 +108,37 @@ class BaseSoC(SoCCore):
|
|||
if with_etherbone:
|
||||
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_timing_constraints=False)
|
||||
|
||||
# Video ------------------------------------------------------------------------------------
|
||||
if with_video_terminal:
|
||||
# FIXME: Un-tested.
|
||||
self.submodules.videophy = VideoHDMIPHY(platform.request("hdmi"), clock_domain="hdmi", pn_swap=["r", "g", "b"])
|
||||
self.add_video_colorbars(phy=self.videophy, timings="640x480@60Hz", clock_domain="hdmi")
|
||||
#self.add_video_terminal(phy=self.videophy, timings="640x480@75Hz", clock_domain="hdmi")
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
if with_led_chaser:
|
||||
self.submodules.leds = LedChaser(
|
||||
pads = platform.request_all("led"),
|
||||
sys_clk_freq = sys_clk_freq
|
||||
)
|
||||
|
||||
# RGB Led ----------------------------------------------------------------------------------
|
||||
if with_rgb_led:
|
||||
self.submodules.rgb_led = WS2812(
|
||||
pad = platform.request("rgb_led"),
|
||||
nleds = 1,
|
||||
sys_clk_freq = sys_clk_freq
|
||||
)
|
||||
self.bus.add_slave(name="rgb_led", slave=self.rgb_led.bus, region=SoCRegion(
|
||||
origin = 0x2000_0000,
|
||||
size = 4,
|
||||
))
|
||||
|
||||
# Buttons ----------------------------------------------------------------------------------
|
||||
if with_buttons:
|
||||
self.submodules.buttons = GPIOIn(pads=~platform.request_all("btn_n"))
|
||||
|
||||
|
||||
# Build --------------------------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in a new issue