Skip to content

Commit b210eae

Browse files
Sidecar Power and Thermal management (#580)
Co-authored-by: Matt Keeter <[email protected]>
1 parent 6300f11 commit b210eae

File tree

16 files changed

+478
-109
lines changed

16 files changed

+478
-109
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/gimlet/rev-a.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ task-slots = ["sys", "i2c_driver"]
123123

124124
[tasks.thermal]
125125
name = "task-thermal"
126-
features = ["itm", "h753", "gimlet"]
126+
features = ["itm", "gimlet"]
127127
priority = 5
128128
requires = {flash = 16384, ram = 8192 }
129129
stacksize = 4504
@@ -132,7 +132,7 @@ task-slots = ["i2c_driver", "sensor", "gimlet_seq", "jefe"]
132132

133133
[tasks.power]
134134
name = "task-power"
135-
features = ["itm", "h753"]
135+
features = ["itm", "gimlet"]
136136
priority = 5
137137
requires = {flash = 16384, ram = 4096 }
138138
stacksize = 2048

app/gimlet/rev-b.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ task-slots = ["sys", "i2c_driver"]
135135

136136
[tasks.thermal]
137137
name = "task-thermal"
138-
features = ["itm", "h753", "gimlet"]
138+
features = ["itm", "gimlet"]
139139
priority = 5
140140
requires = {flash = 32768, ram = 8192 }
141141
stacksize = 4504
@@ -144,7 +144,7 @@ task-slots = ["i2c_driver", "sensor", "gimlet_seq", "jefe"]
144144

145145
[tasks.power]
146146
name = "task-power"
147-
features = ["itm", "h753"]
147+
features = ["itm", "gimlet"]
148148
priority = 6
149149
requires = {flash = 16384, ram = 4096 }
150150
stacksize = 2048

app/sidecar/app.toml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ stacksize = 896
66

77
[kernel]
88
name = "sidecar"
9-
requires = {flash = 32768, ram = 4192}
9+
requires = {flash = 32768, ram = 8192}
1010
#
1111
# For the kernel (and for any task that logs), we are required to enable
1212
# either "itm" (denoting logging/panicking via ARM's Instrumentation Trace
@@ -164,7 +164,7 @@ task-slots = ["sys"]
164164
[tasks.hiffy]
165165
name = "task-hiffy"
166166
features = ["h753", "spi", "stm32h7", "itm", "i2c", "gpio"]
167-
priority = 3
167+
priority = 5
168168
requires = {flash = 32768, ram = 16384 }
169169
stacksize = 1024
170170
start = true
@@ -173,7 +173,7 @@ task-slots = ["sys", "i2c_driver"]
173173
[tasks.sensor]
174174
name = "task-sensor"
175175
features = ["itm"]
176-
priority = 3
176+
priority = 4
177177
requires = {flash = 8192, ram = 2048 }
178178
stacksize = 1920 # Sensor data is stored on the stack
179179
start = true
@@ -195,9 +195,35 @@ stacksize = 1024
195195
start = true
196196
task-slots = ["sys", "i2c_driver", {fpga = "ecp5_mainboard"}]
197197

198+
[tasks.thermal]
199+
name = "task-thermal"
200+
features = ["itm", "sidecar"]
201+
priority = 5
202+
requires = {flash = 32768, ram = 8192 }
203+
stacksize = 4504
204+
start = true
205+
task-slots = ["i2c_driver", "sensor", "sequencer"]
206+
207+
[tasks.power]
208+
name = "task-power"
209+
features = ["itm", "sidecar"]
210+
priority = 6
211+
requires = {flash = 16384, ram = 4096 }
212+
stacksize = 2048
213+
start = true
214+
task-slots = ["i2c_driver", "sensor", "sequencer"]
215+
216+
[tasks.validate]
217+
name = "task-validate"
218+
priority = 5
219+
requires = {flash = 8192, ram = 4096 }
220+
stacksize = 1000
221+
start = true
222+
task-slots = ["i2c_driver"]
223+
198224
[tasks.idle]
199225
name = "task-idle"
200-
priority = 6
226+
priority = 7
201227
requires = {flash = 128, ram = 256}
202228
stacksize = 256
203229
start = true
@@ -218,6 +244,7 @@ controller = 1
218244
name = "northeast0"
219245
description = "Northeast Corridor 0"
220246
pins = [ { gpio_port = "B", pins = [ 6, 7 ], af = 4 } ]
247+
muxes = [ { driver = "pca9548", address = 0x70 } ]
221248

222249
#
223250
# I2C_NORTH_EAST1_SCL
@@ -284,6 +311,7 @@ af = 4
284311
name = "northwest1"
285312
description = "Northwest Corridor 1"
286313
pins = [ { pins = [ 7, 8 ], af = 4 } ]
314+
muxes = [ { driver = "pca9548", address = 0x70 } ]
287315

288316
#
289317
# I2C4: South bend
@@ -331,6 +359,7 @@ refdes = "U6"
331359
bus = "northeast0"
332360
address = 0b0100_011
333361
device = "max31790"
362+
name = "East"
334363
description = "Fan 0/1 controller"
335364
sensors = { speed = 4 }
336365
refdes = "U66"
@@ -339,7 +368,7 @@ refdes = "U66"
339368
bus = "northeast0"
340369
address = 0b1001_001
341370
device = "tmp117"
342-
name = "nne"
371+
name = "NNE"
343372
description = "North-northeast temperature sensor"
344373
sensors = { temperature = 1 }
345374
refdes = "J69"
@@ -383,10 +412,11 @@ refdes = "U19"
383412
bus = "northeast1"
384413
address = 0b1001_000
385414
device = "tmp117"
386-
name = "northeast"
415+
name = "Northeast"
387416
description = "Northeast temperature sensor"
388417
sensors = { temperature = 1 }
389418
refdes = "J70"
419+
removable = true
390420

391421
[[config.i2c.devices]]
392422
bus = "northwest0"
@@ -397,12 +427,6 @@ pmbus = { rails = [ "V54_HSC" ] }
397427
sensors = { temperature = 1, voltage = 1, current = 1 }
398428
refdes = "U2"
399429

400-
[[config.i2c.devices]]
401-
bus = "northwest0"
402-
address = 0b0010_111
403-
device = "bmr480"
404-
description = "IBC"
405-
406430
[[config.i2c.devices]]
407431
bus = "northwest0"
408432
address = 0b0011_001
@@ -416,7 +440,7 @@ refdes = "U18"
416440
bus = "northwest0"
417441
address = 0b1001_000
418442
device = "tmp117"
419-
name = "nnw"
443+
name = "NNW"
420444
description = "North-northwest temperature sensor"
421445
sensors = { temperature = 1 }
422446
refdes = "J68"
@@ -426,6 +450,7 @@ removable = true
426450
bus = "northwest0"
427451
address = 0b1001_100
428452
device = "tmp451"
453+
name = "tf2"
429454
description = "TF2 temperature sensor"
430455
sensors = { temperature = 1 }
431456
refdes = "U64"
@@ -443,10 +468,10 @@ refdes = "U32"
443468
bus = "northwest0"
444469
address = 0b1100_111
445470
device = "bmr491"
446-
name = "ibc"
471+
name = "IBC"
447472
description = "Intermediate bus converter"
448473
pmbus = { rails = [ "V12P0_SYS" ] }
449-
sensors = { temperature = 1, power = 1, voltage = 1 }
474+
sensors = { temperature = 1, power = 1, voltage = 1, current = 1 }
450475
refdes = "U12"
451476

452477
[[config.i2c.devices]]
@@ -471,16 +496,17 @@ refdes = "U10"
471496
bus = "northwest1"
472497
address = 0b1001_001
473498
device = "tmp117"
474-
name = "northwest"
499+
name = "Northwest"
475500
description = "Northwest temperature sensor"
476501
sensors = { temperature = 1 }
477502
refdes = "J67"
478503
removable = true
479504

480505
[[config.i2c.devices]]
481506
bus = "northwest1"
482-
address = 0b1000_000
507+
address = 0b0100_000
483508
device = "max31790"
509+
name = "West"
484510
description = "Fan 2/3 controller"
485511
sensors = { speed = 4 }
486512
refdes = "U78"
@@ -516,26 +542,29 @@ refdes = "U38"
516542
bus = "south0"
517543
address = 0b1001_010
518544
device = "tmp117"
519-
name = "south"
545+
name = "South"
520546
description = "South temperature sensor"
547+
sensors = { temperature = 1 }
521548
refdes = "J71"
522549
removable = true
523550

524551
[[config.i2c.devices]]
525552
bus = "south0"
526553
address = 0b1001_000
527554
device = "tmp117"
528-
name = "southeast"
555+
name = "Southeast"
529556
description = "Southeast temperature sensor"
557+
sensors = { temperature = 1 }
530558
refdes = "J73"
531559
removable = true
532560

533561
[[config.i2c.devices]]
534562
bus = "south0"
535563
address = 0b1001_001
536564
device = "tmp117"
537-
name = "southwest"
565+
name = "Southwest"
538566
description = "Southwest temperature sensor"
567+
sensors = { temperature = 1 }
539568
refdes = "J72"
540569
removable = true
541570

@@ -561,6 +590,7 @@ refdes = "U20"
561590
bus = "south1"
562591
address = 0b1001_100
563592
device = "tmp451"
593+
name = "vsc7448"
564594
description = "VSC7448 temperature sensor"
565595
sensors = { temperature = 1 }
566596
refdes = "U65"

drv/gimlet-seq-server/src/seq_spi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl SequencerFpga {
4040
}
4141

4242
/// Check for a valid identifier, deliberately eating any SPI errors.
43+
#[allow(dead_code)]
4344
pub fn valid_ident(&self) -> bool {
4445
if let Ok(ident) = self.read_ident() {
4546
ident == EXPECTED_IDENT

drv/i2c-devices/src/isl68224.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use core::cell::Cell;
66

7-
use crate::{CurrentSensor, Validate, VoltageSensor};
7+
use crate::{CurrentSensor, TempSensor, Validate, VoltageSensor};
88
use drv_i2c_api::*;
99
use pmbus::commands::isl68224::*;
1010
use pmbus::commands::CommandCode;
@@ -104,6 +104,14 @@ impl VoltageSensor<Error> for Isl68224 {
104104
}
105105
}
106106

107+
impl TempSensor<Error> for Isl68224 {
108+
fn read_temperature(&self) -> Result<Celsius, Error> {
109+
self.set_rail()?;
110+
let temp = pmbus_read!(self.device, READ_TEMPERATURE_1)?;
111+
Ok(Celsius(temp.get()?.0))
112+
}
113+
}
114+
107115
impl CurrentSensor<Error> for Isl68224 {
108116
fn read_iout(&self) -> Result<Amperes, Error> {
109117
self.set_rail()?;

drv/i2c-devices/src/max31790.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use userlib::units::*;
1212
use userlib::*;
1313

1414
#[allow(dead_code)]
15+
#[derive(Copy, Clone, Debug)]
1516
pub enum I2cWatchdog {
1617
Disabled = 0b00,
1718
FiveSeconds = 0b01,

task/power/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ cortex-m = {version = "0.7", features = ["inline-asm"]}
1111
zerocopy = "0.6.1"
1212
cfg-if = "1"
1313
drv-i2c-devices = { path = "../../drv/i2c-devices" }
14-
drv-gimlet-seq-api = {path = "../../drv/gimlet-seq-api"}
14+
drv-gimlet-seq-api = {path = "../../drv/gimlet-seq-api", optional = true}
15+
drv-sidecar-seq-api = {path = "../../drv/sidecar-seq-api", optional = true}
1516
task-sensor-api = {path = "../sensor-api"}
1617
paste = "1.0.6"
1718

@@ -22,6 +23,8 @@ anyhow = "1.0.31"
2223
cfg-if = "1"
2324

2425
[features]
26+
gimlet = ["drv-gimlet-seq-api", "h753"]
27+
sidecar = ["drv-sidecar-seq-api", "h753"]
2528
itm = [ "userlib/log-itm" ]
2629
semihosting = [ "userlib/log-semihosting" ]
2730
h743 = ["build-i2c/h743"]

0 commit comments

Comments
 (0)