Skip to content

Commit 6c73757

Browse files
committed
Pin remap after hardware mux reorg for out nibble
1 parent aeb8b64 commit 6c73757

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed

src/ttboard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
@author: Pat Deegan
77
@copyright: Copyright (C) 2024 Pat Deegan, https://psychogenic.com
88
'''
9-
VERSION='0.9.2'
9+
VERSION='0.9.4'

src/ttboard/demoboard.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def project_nrst(self):
155155
156156
@see: reset_project()
157157
'''
158-
return self.pins.nproject_rst
158+
return self.pins.nprojectrst
159+
159160

160161
def reset_project(self, putInReset:bool):
161162
'''

src/ttboard/pins/gpio_map.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class GPIOMap:
1818
myrawpin = machine.Pin(GPIOMap.OUT4, machine.Pin.OUT)
1919
2020
The only caveat is that some of these are duplexed through
21-
the MUX, and named accordingly (e.g. SDI_OUT0)
21+
the MUX, and named accordingly (e.g. nCRST_OUT2)
2222
'''
2323
RP_PROJCLK = 0
2424
HK_CSB = 1
2525
HK_SCK = 2
26-
SDI_OUT0 = 3
27-
SDO_OUT1 = 4
28-
nPROJECT_RST = 5
29-
CTRL_ENA = 6
26+
SDI_nPROJECT_RST = 3 # SDI_OUT0 = 3
27+
HK_SDO = 4 # SDO_OUT1 = 4
28+
OUT0 = 5 # nPROJECT_RST = 5
29+
CTRL_ENA_OUT1 = 6 # CTRL_ENA = 6
3030
nCRST_OUT2 = 7
3131
CINC_OUT3 = 8
3232
IN0 = 9
@@ -54,8 +54,8 @@ class GPIOMap:
5454
@classmethod
5555
def muxed_pairs(cls):
5656
mpairnames = [
57-
'sdi_out0',
58-
'sdo_out1',
57+
'sdi_nprojectrst',
58+
'cena_out1',
5959
'ncrst_out2',
6060
'cinc_out3'
6161
]
@@ -70,14 +70,17 @@ def muxed_pairs(cls):
7070
def muxed_pinmode_map(cls, rpmode:int):
7171

7272
pinModeMap = {
73-
'out0': Pin.IN,
74-
'out1': Pin.IN,
75-
'out2': Pin.IN,
76-
'out3': Pin.IN,
73+
'nprojectrst': Pin.OUT,
7774
'sdi': Pin.OUT,
78-
'sdo': Pin.IN,
75+
'cena': Pin.OUT,
76+
'out1': Pin.IN,
77+
7978
'ncrst': Pin.OUT,
79+
'out2': Pin.IN,
80+
81+
8082
'cinc': Pin.OUT,
83+
'out3': Pin.IN
8184
}
8285
if rpmode == RPModeDEVELOPMENT.STANDALONE:
8386
for k in pinModeMap.keys():
@@ -92,25 +95,32 @@ def always_outputs(cls):
9295
return [
9396
# 'nproject_rst',
9497
# 'rp_projclk', -- don't do this during "safe" operation
95-
'ctrl_ena'
98+
#'ctrl_ena'
9699
]
97100

98101
@classmethod
99102
def default_pull(cls, pin):
100-
if pin in ["nproject_rst", "ctrl_ena"]:
101-
return Pin.PULL_UP
103+
# both of these now go through MUX and
104+
# must therefore rely on external/physical
105+
# pull-ups. the nProject reset has PU in
106+
# switch debounce, cena... may be a problem
107+
# (seems it has a pull down on board?)
108+
#if pin in ["nproject_rst", "ctrl_ena"]:
109+
# return Pin.PULL_UP
102110
return Pin.PULL_DOWN
103111

104112
@classmethod
105113
def all(cls):
114+
# mods made to MUX between TT03p5 proto and
115+
# CM assembly run, noted here with comments for now
106116
retDict = {
107117
"rp_projclk": cls.RP_PROJCLK,
108118
"hk_csb": cls.HK_CSB,
109119
"hk_sck": cls.HK_SCK,
110-
"sdi_out0": cls.SDI_OUT0,
111-
"sdo_out1": cls.SDO_OUT1,
112-
"nproject_rst": cls.nPROJECT_RST,
113-
"ctrl_ena": cls.CTRL_ENA,
120+
"sdi_nprojectrst": cls.SDI_nPROJECT_RST, # "sdi_out0": cls.SDI_OUT0,
121+
"hk_sdo": cls.HK_SDO, # "sdo_out1": cls.SDO_OUT1,
122+
"out0": cls.OUT0,
123+
"cena_out1": cls.CTRL_ENA_OUT1, # "ctrl_ena": cls.CTRL_ENA,
114124
"ncrst_out2": cls.nCRST_OUT2,
115125
"cinc_out3": cls.CINC_OUT3,
116126
"in0": cls.IN0,

src/ttboard/pins/pins.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ def begin_standalone(self):
299299

300300
def project_clk_nrst_driven_by_RP2040(self, rpControlled:bool):
301301

302-
for pname in ['nproject_rst', 'rp_projclk']:
302+
# for pname in ['nprojectrst', 'rp_projclk']:
303+
for pname in ['rp_projclk']:
303304
p = getattr(self, pname)
304305
if rpControlled:
305306
p.mode = Pin.OUT
@@ -315,6 +316,8 @@ def _begin_muxPins(self):
315316
muxedPins = GPIOMap.muxed_pairs()
316317
modeMap = GPIOMap.muxed_pinmode_map(self.mode)
317318
for pname, muxPair in muxedPins.items():
319+
print("********************************")
320+
print (muxPair)
318321
mp = MuxedPin(pname, self.muxCtrl,
319322
getattr(self, pname),
320323
MuxedPinInfo(muxPair[0],
@@ -334,6 +337,18 @@ def _begin_muxPins(self):
334337
def project_clk(self):
335338
return self.rp_projclk
336339

340+
@property
341+
def nproject_rst(self):
342+
# had to munge the name because nproject_rst
343+
# is now in hardware MUX group, alias
344+
# allows use of old name with_underscore
345+
return self.nprojectrst
346+
347+
@property
348+
def ctrl_ena(self):
349+
# had to munge name, now going through hw mux
350+
return self.cena
351+
337352
def _dumpPin(self, p:StandardPin):
338353
print(f' {p.name} {p.mode_str} {p()}')
339354
def dump(self):

src/ttboard/project_mux.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def reset(self):
7474
log.debug('Resetting project mux')
7575
self.p.cinc(0)
7676
self.p.ncrst(0)
77-
self.p.ctrl_ena(0)
77+
self.p.cena(0)
7878
time.sleep_ms(10)
7979
self.p.ncrst(1)
8080
time.sleep_ms(10)
@@ -108,7 +108,7 @@ def reset_and_clock_mux(self, count:int):
108108
self.p.cinc(0)
109109
time.sleep_ms(1)
110110

111-
self.p.ctrl_ena(1)
111+
self.p.cena(1)
112112
self.p.muxCtrl.mode_project_IO()
113113

114114
@property

0 commit comments

Comments
 (0)