Skip to content

Commit

Permalink
gimlet-seq-server: start driving fault pin.
Browse files Browse the repository at this point in the history
This pulls the fault pin low (active) shortly after the sequencer task
first runs, and then sets it high (inactive) only once we get up to the
IPC loop.

Failures in the sequencer startup tend to cause panics, which will have
the effect of holding the pin low as the task is repeatedly restarted.
This also means we will be able to externally observe any other restart
of the task.
  • Loading branch information
cbiffle committed Nov 3, 2023
1 parent 651a954 commit 72184cb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drv/gimlet-seq-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ fn main() -> ! {
let jefe = Jefe::from(JEFE.get_task_id());
let hf = hf_api::HostFlash::from(HF.get_task_id());

// Ensure the SP fault pin is configured as an open-drain output, and pull
// it low to make the sequencer restart externally visible.
sys.gpio_configure_output(
FAULT_PIN_L,
sys_api::OutputType::OpenDrain,
sys_api::Speed::Low,
sys_api::Pull::None,
);
sys.gpio_reset(FAULT_PIN_L);

// Turn off the chassis LED, in case this is a task restart (and not a
// full chip restart, which would leave the GPIO unconfigured).
sys.gpio_configure_output(
Expand Down Expand Up @@ -403,6 +413,10 @@ fn main() -> ! {
sys_api::Pull::None,
);

// Clear the external fault now that we're about to start serving messages
// and fewer things can go wrong.
sys.gpio_set(FAULT_PIN_L);

loop {
idol_runtime::dispatch_n(&mut buffer, &mut server);
}
Expand Down Expand Up @@ -1135,6 +1149,8 @@ cfg_if::cfg_if! {

// SP_STATUS_LED
const CHASSIS_LED: sys_api::PinSet = sys_api::Port::A.pin(3);
// SP_TO_IGNIT_FAULT_L
const FAULT_PIN_L: sys_api::PinSet = sys_api::Port::A.pin(15);

// Gimlet provides external pullups.
const PGS_PULL: sys_api::Pull = sys_api::Pull::None;
Expand Down

0 comments on commit 72184cb

Please sign in to comment.