Skip to content

Commit a1eab65

Browse files
committed
TT dbv3 (HRS connectors), first iteration
1 parent d98dcc7 commit a1eab65

File tree

10 files changed

+593
-328
lines changed

10 files changed

+593
-328
lines changed

src/ttboard/boot/demoboard_detect.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ttboard.pins.upython import Pin
99
import ttboard.pins.gpio_map
1010
from ttboard.pins.gpio_map import GPIOMapTT04, GPIOMapTT06
11+
from ttboard.pins.gpio_map_dbv3 import GPIOMapTTDBv3
1112

1213
import ttboard.log as logging
1314
log = logging.getLogger(__name__)
@@ -20,13 +21,15 @@ class DemoboardVersion:
2021
UNKNOWN = 0
2122
TT04 = 1
2223
TT06 = 2
24+
TTDBv3 = 3
2325

2426
@classmethod
2527
def to_string(cls, v:int):
2628
asStr = {
2729
cls.UNKNOWN: 'UNKNOWN',
2830
cls.TT04: 'TT04/TT05',
29-
cls.TT06: 'TT06+'
31+
cls.TT06: 'TT06+',
32+
cls.TTDBv3: 'TTDBv3',
3033
}
3134
if v in asStr:
3235
return asStr[v]
@@ -133,6 +136,18 @@ def probe_tt04mux(cls):
133136

134137
log.debug("Mux twiddle has no effect, probably not TT04 db")
135138
return False
139+
140+
@classmethod
141+
def probe_rp2350(cls):
142+
try:
143+
_p = Pin(37, Pin.IN)
144+
except ValueError:
145+
return False
146+
cls.PCB = DemoboardVersion.TTDBv3
147+
cls.CarrierPresent = True
148+
cls.CarrierVersion = DemoboardCarrier.TT_CARRIER # TODO: FIXME just assuming carrier here
149+
return True
150+
136151
@classmethod
137152
def rp_all_inputs(cls):
138153
log.debug("Setting all RP GPIO to INPUTS")
@@ -146,12 +161,9 @@ def rp_all_inputs(cls):
146161
def probe(cls):
147162
result = False
148163
cls.rp_all_inputs()
149-
if cls.probe_tt04mux():
150-
cls._configure_gpiomap()
151-
result = True
152-
elif cls.probe_pullups():
164+
if cls.probe_rp2350() or cls.probe_tt04mux() or cls.probe_pullups():
153165
cls._configure_gpiomap()
154-
result = True
166+
result = True
155167
else:
156168
log.debug("Neither pullup nor tt04mux tests conclusive, assuming TT06+ board")
157169
cls.PCB = DemoboardVersion.TT06
@@ -171,7 +183,8 @@ def _configure_gpiomap(cls):
171183
mapToUse = {
172184

173185
DemoboardVersion.TT04: GPIOMapTT04,
174-
DemoboardVersion.TT06: GPIOMapTT06
186+
DemoboardVersion.TT06: GPIOMapTT06,
187+
DemoboardVersion.TTDBv3: GPIOMapTTDBv3,
175188

176189
}
177190
if cls.PCB in mapToUse:

src/ttboard/demoboard.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,14 @@ def __init__(self,
125125
'tt06': DemoboardVersion.TT06,
126126
'tt07': DemoboardVersion.TT06,
127127
'tt08': DemoboardVersion.TT06,
128-
'tt09': DemoboardVersion.TT06,
129-
'tt10': DemoboardVersion.TT06,
128+
'ttDBv3': DemoboardVersion.TTDBv3,
130129

131130
}
132131
if self.user_config.force_demoboard in versionMap:
133132
log.warn(f'Demoboard detection forced to {self.user_config.force_demoboard}')
134133
DemoboardDetect.force_detection(versionMap[self.user_config.force_demoboard])
135134
else:
136-
log.error(f'Unrecognized force_demoboard setting: {self.user_config.force_demoboard}')
135+
log.error(f'Unrecognized force_demoboard setting: {self.user_config.force_demoboard} ?')
137136

138137

139138

src/ttboard/pins/gpio_map.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def all_common(cls):
105105
"uio5": cls.UIO5,
106106
"uio6": cls.UIO6,
107107
"uio7": cls.UIO7,
108-
"rpio29": cls.RPIO29
109108
}
110109
return retDict
111110

@@ -198,6 +197,7 @@ def all(cls):
198197
"cena_uo_out1": cls.CTRL_ENA_UO_OUT1, # "ctrl_ena": cls.CTRL_ENA,
199198
"ncrst_uo_out2": cls.nCRST_UO_OUT2,
200199
"cinc_uo_out3": cls.CINC_UO_OUT3,
200+
"rpio29": cls.RPIO29,
201201
})
202202
return retDict
203203
@classmethod
@@ -316,7 +316,8 @@ def all(cls):
316316
'uo_out0': cls.UO_OUT0,
317317
'uo_out1': cls.UO_OUT1,
318318
'uo_out2': cls.UO_OUT2,
319-
'uo_out3': cls.UO_OUT3
319+
'uo_out3': cls.UO_OUT3,
320+
"rpio29": cls.RPIO29
320321
})
321322

322323
if cls.tt07_cb_fix:

src/ttboard/pins/gpio_map_dbv3.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
'''
2+
Created on Nov 8, 2025
3+
4+
@author: Pat Deegan
5+
@copyright: Copyright (C) 2025 Pat Deegan, https://psychogenic.com
6+
'''
7+
from ttboard.pins.gpio_map import GPIOMapBase
8+
9+
class GPIOMapTTDBv3(GPIOMapBase):
10+
RP_PROJCLK = 21
11+
PROJECT_nRST = 20
12+
CTRL_SEL_nRST = 1
13+
CTRL_SEL_INC = 2
14+
CTRL_SEL_ENA = 0
15+
UO_OUT0 = 30
16+
UO_OUT1 = 31
17+
UO_OUT2 = 32
18+
UO_OUT3 = 33
19+
UO_OUT4 = 34
20+
UO_OUT5 = 35
21+
UO_OUT6 = 36
22+
UO_OUT7 = 37
23+
UI_IN0 = 12
24+
UI_IN1 = 13
25+
UI_IN2 = 14
26+
UI_IN3 = 15
27+
UI_IN4 = 16
28+
UI_IN5 = 17
29+
UI_IN6 = 18
30+
UI_IN7 = 19
31+
UIO0 = 22
32+
UIO1 = 23
33+
UIO2 = 24
34+
UIO3 = 25
35+
UIO4 = 26
36+
UIO5 = 27
37+
UIO6 = 28
38+
UIO7 = 29
39+
RP_LED = 11
40+
41+
# Enable a workaround for a PCB error in TT07 carrier board, which swapped the ctrl_sel_inc and ctrl_sel_nrst lines:
42+
tt07_cb_fix = False
43+
44+
@classmethod
45+
def project_clock(cls):
46+
return cls.RP_PROJCLK
47+
48+
@classmethod
49+
def project_reset(cls):
50+
return cls.PROJECT_nRST
51+
52+
53+
@classmethod
54+
def ctrl_increment(cls):
55+
return cls.CTRL_SEL_INC
56+
57+
@classmethod
58+
def ctrl_enable(cls):
59+
return cls.CTRL_SEL_ENA
60+
61+
@classmethod
62+
def ctrl_reset(cls):
63+
return cls.CTRL_SEL_nRST
64+
65+
@classmethod
66+
def always_outputs(cls):
67+
return [
68+
'cinc',
69+
'cena',
70+
'ncrst'
71+
]
72+
@classmethod
73+
def all(cls):
74+
retDict = cls.all_common()
75+
76+
retDict.update({
77+
'nprojectrst': cls.PROJECT_nRST,
78+
'cinc': cls.CTRL_SEL_INC,
79+
'cena': cls.CTRL_SEL_ENA,
80+
'ncrst': cls.CTRL_SEL_nRST,
81+
'uo_out0': cls.UO_OUT0,
82+
'uo_out1': cls.UO_OUT1,
83+
'uo_out2': cls.UO_OUT2,
84+
'uo_out3': cls.UO_OUT3
85+
})
86+
87+
return retDict

0 commit comments

Comments
 (0)