-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ato
More file actions
210 lines (182 loc) · 6.99 KB
/
Copy pathmain.ato
File metadata and controls
210 lines (182 loc) · 6.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#pragma experiment("BRIDGE_CONNECT")
#pragma experiment("FOR_LOOP")
import Electrical
import ElectricPower
import ElectricLogic
import Resistor
import UART_Base
import USB2_0
import SWD
import JTAG
from "atopile/raspberry-rp2040/raspberry-rp2040.ato" import Raspberry_Pi_RP2040
from "atopile/usb-connectors/usb-connectors.ato" import USB2_0TypeCHorizontalConnector
from "atopile/indicator-leds/indicator-leds.ato" import LEDIndicatorRed
from "atopile/indicator-leds/indicator-leds.ato" import LEDIndicatorGreen
from "atopile/indicator-leds/indicator-leds.ato" import LEDIndicatorBlue
from "atopile/logos/logos.ato" import atopile_logo_25x6mm
from "ruben-iteng/ldos/ldos.ato" import LDO_5V_to_3V3
from "modules/debug-connectors.ato" import ARMCortexMDebugHeader
from "modules/debug-connectors.ato" import JLINKInterfaceTHHorizontal
from "modules/debug-connectors.ato" import JLINKInterfaceSMDVertical
from "modules/wuxi-aip74lvc1t45.ato" import Wuxi_I_core_Elec_AiP74LVC1T45GB236_TR
from "modules/uart_connector.ato" import UARTConnectorVertical
from "modules/uart_connector.ato" import UARTConnectorHorizontal
from "parts/Sinhoo_SMTSO1630MTJ/Sinhoo_SMTSO1630MTJ.ato" import Sinhoo_SMTSO1630MTJ_package
from "parts/Sinhoo_SMTSO2530CTJ/Sinhoo_SMTSO2530CTJ.ato" import Sinhoo_SMTSO2530CTJ_package
from "parts/RPDAP_Compact/RPDAP_Compact.ato" import RPDAP_Compact_package
module RPDAPStick:
"""
RPDAP stick shaped PCBA designed for Standalone/desktop use.
Has a USB Type-C connector for power and data, a UART connector for debugging,
and a Cortex-M debug header for SWD debugging.
"""
# --- Components ---
rpdap = new RPDAP
usb_connector = new USB2_0TypeCHorizontalConnector
debug_connector = new ARMCortexMDebugHeader
uart_connector = new UARTConnectorVertical
standoff = new Sinhoo_SMTSO1630MTJ_package[4]
atopile_logo = new atopile_logo_25x6mm
# --- Connections ---
rpdap.usb ~ usb_connector.usb
rpdap.swd ~ debug_connector.swd
rpdap.jtag ~ debug_connector.jtag
rpdap.uart ~ uart_connector.uart
debug_connector.ground_detect.line ~ debug_connector.ground_detect.reference_shim.lv
for so in standoff:
so.1 ~ rpdap._power_3v3.lv
module RPDAPCompact:
"""
RPDAP PCBA designed with JLink Base Compact layout and pinout.
"""
# --- Components ---
rpdap = new RPDAPBase
usb_connector = new USB2_0TypeCHorizontalConnector
debug_connector = new JLINKInterfaceTHHorizontal
uart_connector = new UARTConnectorHorizontal
atopile_logo = new atopile_logo_25x6mm
# --- Connections ---
rpdap.usb ~ usb_connector.usb
rpdap.swd ~ debug_connector.swd
rpdap.jtag ~ debug_connector.jtag
# rpdap.uart ~ debug_connector.uart
# Not connected, this debugger supports UART both in SWD and JTAG mode (unlike original JLINK).
rpdap._power_vbus ~ debug_connector.power_5v
rpdap.uart ~ uart_connector.uart
module RPDAPCompactOnBoard:
"""
RPDAP Compact or SEGGER JLink Base Compact module mount for use test and provisioning equipment.
"""
# --- Components ---
debugger = new RPDAP_Compact_package
standoff = new Sinhoo_SMTSO2530CTJ_package[2]
jlink_header = new JLINKInterfaceSMDVertical
module RPDAP from RPDAPBase:
"""
RPDAP module with layout for inclusion in your own design.
A RP2040 based USB SWD, JTAG, and UART interface for flashing and debugging.
CMSIS-DAP compatible.
"""
module RPDAPBase:
"""
RPDAP module for inclusion in your own design.
A RP2040 based USB SWD, JTAG, and UART interface for flashing and debugging.
CMSIS-DAP compatible.
"""
# --- Components ---
mcu = new Raspberry_Pi_RP2040
level_shifter = new Wuxi_I_core_Elec_AiP74LVC1T45GB236_TR[7]
ldo = new LDO_5V_to_3V3
power_3v3_indicator = new LEDIndicatorRed
vcp_indicator = new LEDIndicatorBlue
# -- External interfaces --
usb = new USB2_0
"""USB interface of the mcu to the host"""
usb.required = True
uart = new UART_Base
"""UART port to connect to the target for sending and receiving logging"""
uart.required = True
swd = new SWD
"""SWD interface to the target"""
swd.required = True
jtag = new JTAG
"""JTAG interface to the target"""
jtag.required = True
# --- Internal interfaces ---
# Power rails
_power_vbus = new ElectricPower
_power_3v3 = new ElectricPower
# -- Connections --
# Power
usb.usb_if.buspower ~ _power_vbus
_power_vbus ~ ldo.power_in
ldo.power_out ~ _power_3v3
mcu.power ~ _power_3v3
# USB data
usb ~ mcu.usb
# Level shifters share references
for ls in level_shifter:
ls.power_a ~ _power_3v3
ls.power_b ~ jtag.vtref
# Direction of the level shifters and MCU GPIO mapping
# A side is MCU, B side is target.
# gpio[12]: SWDIO/TMS (bidirectional, DIR via GPIO9)
# gpio[11]: SWCLK/TCK (A->B)
# gpio[13]: TDI (A->B)
# gpio[14]: TDO (B->A)
# gpio[15]: nRESET (A->B)
# gpio[0]: VCP TX (A->B)
# gpio[1]: VCP RX (B->A)
# gpio[2]: VCP status indicator
# gpio[25]: DAP status indicator (in RP2040 reference design)
# TMS/SWDIO
mcu.gpio[12] ~ level_shifter[0].a
level_shifter[0].b ~ jtag.tms
mcu.gpio[9] ~ level_shifter[0].dir
swd.dio ~ jtag.tms
jtag.tms.line.override_net_name = "TMS_DIO"
# TCK/SWCLK
mcu.gpio[11] ~ level_shifter[1].a
level_shifter[1].b ~ jtag.tck
# DIR = High (MCU->Target)
level_shifter[1].dir.line ~ level_shifter[1].dir.reference_shim.hv
swd.clk ~ jtag.tck
jtag.tck.line.override_net_name = "TCK_SWCLK"
# TDO/SWO
mcu.gpio[14] ~ level_shifter[2].a
level_shifter[2].b ~ jtag.tdo
# DIR = Low (Target->MCU)
level_shifter[2].dir.line ~ level_shifter[2].dir.reference_shim.lv
swd.swo ~ jtag.tdo
jtag.tdo.line.override_net_name = "TDO_SWO"
# nRESET
mcu.gpio[15] ~ level_shifter[3].a
level_shifter[3].b ~ jtag.n_reset
# DIR = High (MCU->Target)
level_shifter[3].dir.line ~ level_shifter[3].dir.reference_shim.hv
swd.reset ~ jtag.n_reset
jtag.n_reset.line.override_net_name = "nRESET"
# TDI
mcu.gpio[13] ~ level_shifter[4].a
level_shifter[4].b ~ jtag.tdi
# DIR = HIGH (MCU->Target)
level_shifter[4].dir.line ~ level_shifter[4].dir.reference_shim.hv
jtag.tdi.line.override_net_name = "TDI"
# UART0 TX (MCU -> target)
mcu.uart.tx ~ level_shifter[5].a
level_shifter[5].b ~ uart.tx
# DIR = High (MCU->Target)
level_shifter[5].dir.line ~ level_shifter[5].dir.reference_shim.hv
# UART0 RX (target -> MCU)
mcu.uart.rx ~ level_shifter[6].a
level_shifter[6].b ~ uart.rx
# DIR = Low (Target->MCU)
level_shifter[6].dir.line ~ level_shifter[6].dir.reference_shim.lv
# Power indicator
power_3v3_indicator.power ~ _power_3v3
# VCP status indicator
mcu.gpio[2].line ~> vcp_indicator ~> mcu.gpio[2].reference_shim.lv
# --- Net names ---
_power_3v3.hv.override_net_name = "3V3"
_power_3v3.lv.suggest_net_name = "GND"
_power_vbus.hv.override_net_name = "Vbus_fused"