From 28571308bc069cca89c008b0bcf0293dac629bf2 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 16 Sep 2021 19:34:48 +0200 Subject: [PATCH] sispeed_tang_nano: Add simple UART loopback test... (Not working...) --- litex_boards/platforms/sipeed_tang_nano.py | 12 ++++++++++-- litex_boards/targets/sipeed_tang_nano.py | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/litex_boards/platforms/sipeed_tang_nano.py b/litex_boards/platforms/sipeed_tang_nano.py index 15a6525..13e9602 100644 --- a/litex_boards/platforms/sipeed_tang_nano.py +++ b/litex_boards/platforms/sipeed_tang_nano.py @@ -26,8 +26,15 @@ _io = [ ("user_led", 2, Pins("18"), IOStandard("LVCMOS33")), # Buttons. - ("user_btn", 0, Pins("15"), IOStandard("LVCMOS18")), - ("user_btn", 0, Pins("14"), IOStandard("LVCMOS18")), + ("user_btn", 0, Pins("15"), IOStandard("LVCMOS33")), + ("user_btn", 0, Pins("14"), IOStandard("LVCMOS33")), + + # Serial + ("serial", 0, + Subsignal("tx", Pins("8")), + Subsignal("rx", Pins("9")), + IOStandard("LVCMOS33") + ), ] # Connectors --------------------------------------------------------------------------------------- @@ -42,6 +49,7 @@ class Platform(GowinPlatform): def __init__(self): GowinPlatform.__init__(self, "GW1N-LV1QN48C6/I5", _io, _connectors, toolchain="gowin", devicename="GW1N-1") + self.toolchain.options["use_done_as_gpio"] = 1 def create_programmer(self): return OpenFPGALoader("tangnano") diff --git a/litex_boards/targets/sipeed_tang_nano.py b/litex_boards/targets/sipeed_tang_nano.py index b955e3f..3a97333 100755 --- a/litex_boards/targets/sipeed_tang_nano.py +++ b/litex_boards/targets/sipeed_tang_nano.py @@ -44,6 +44,10 @@ class BaseSoC(SoCCore): kwargs["cpu_type"] = None kwargs["with_uart"] = False + # UART loopback. + serial_pads = platform.request("serial") + self.comb += serial_pads.tx.eq(serial_pads.rx) + # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, sys_clk_freq, ident = "LiteX SoC on Tang Nano",