Skip to content

Commit a9147a1

Browse files
committed
targets/adiuvo_forgix: add RP2350 SPIBone option
Add --with-spibone to expose a 3-wire SPIBone Wishbone master on the RP2350 passive-SPI pins. This provides an optional post-configuration RP2350 control path while leaving UARTBone as the default target interface. Use 3-wire mode because the published RP2350 loader configuration has no dedicated FPGA MISO pin, so MOSI is reused bidirectionally by SPIBone. References: - https://bitbucket.org/adiuvo-engineering/forgix_public/src/main/Schematic/RP2350_FPGA_eensy.pdf - https://bitbucket.org/adiuvo-engineering/forgix_public/src/main/Kicad_Project/RP2350_FPGA_eensy-main.zip - https://github.com/enjoy-digital/litex_rp2040_pmod_test
1 parent b5f5547 commit a9147a1

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

litex_boards/platforms/adiuvo_forgix.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
IOStandard("3.3_V_LVTTL_/_LVCMOS"),
3737
),
3838

39+
# Optional 3-wire SPIBone over the RP2350 passive-SPI pins.
40+
("spibone", 0,
41+
Subsignal("cs_n", Pins("G3")),
42+
Subsignal("clk", Pins("F3")),
43+
Subsignal("mosi", Pins("F2")),
44+
IOStandard("3.3_V_LVTTL_/_LVCMOS"),
45+
),
46+
3947
# FPGA I/Os routed to the Teensy-style edge connector.
4048
("user_io", 0, Pins(
4149
"A5 D7 C7 D6 G7 G5 G2 F5 F6",

litex_boards/targets/adiuvo_forgix.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from litex.soc.integration.soc import *
1616
from litex.soc.integration.builder import *
1717
from litex.soc.cores.led import LedChaser
18+
from litex.soc.cores.spi.spi_bone import SPIBone
1819

1920
# CRG ----------------------------------------------------------------------------------------------
2021

@@ -37,7 +38,7 @@ def __init__(self, platform, sys_clk_freq):
3738
# BaseSoC ------------------------------------------------------------------------------------------
3839

3940
class BaseSoC(SoCMini):
40-
def __init__(self, sys_clk_freq=32e6, with_led_chaser=True, **kwargs):
41+
def __init__(self, sys_clk_freq=32e6, with_spibone=False, with_led_chaser=True, **kwargs):
4142
platform = adiuvo_forgix.Platform()
4243

4344
# CRG --------------------------------------------------------------------------------------
@@ -53,6 +54,12 @@ def __init__(self, sys_clk_freq=32e6, with_led_chaser=True, **kwargs):
5354
kwargs["with_uartbone"] = True
5455
SoCMini.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Adiuvo Forgix", **kwargs)
5556

57+
# RP2350 <-> MMAP over 3-wire SPIBone. See the RP-side USB/SPI bridge approach:
58+
# https://github.com/enjoy-digital/litex_rp2040_pmod_test
59+
if with_spibone:
60+
self.spibone = SPIBone(platform.request("spibone"), wires=3)
61+
self.bus.add_master(name="spibone", master=self.spibone.bus)
62+
5663
# Leds -------------------------------------------------------------------------------------
5764
if with_led_chaser:
5865
self.leds = LedChaser(
@@ -66,6 +73,7 @@ def main():
6673
from litex.build.parser import LiteXArgumentParser
6774
parser = LiteXArgumentParser(platform=adiuvo_forgix.Platform, description="LiteX SoC on Adiuvo Forgix.")
6875
parser.add_target_argument("--sys-clk-freq", default=32e6, type=float, help="System clock frequency.")
76+
parser.add_target_argument("--with-spibone", action="store_true", help="Add SPIBone on the RP2350 SPI pins.")
6977
parser.set_defaults(
7078
cpu_type = "None",
7179
integrated_sram_size = 0,
@@ -77,6 +85,7 @@ def main():
7785

7886
soc = BaseSoC(
7987
sys_clk_freq = args.sys_clk_freq,
88+
with_spibone = args.with_spibone,
8089
**parser.soc_argdict)
8190
builder = Builder(soc, **parser.builder_argdict)
8291
if args.build:

0 commit comments

Comments
 (0)