Skip to content

Commit

Permalink
Support NVM hard resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLafleur committed Nov 10, 2024
1 parent eb2a40e commit fc653b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions conUDS/src/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum ArgSubCommands {
Reset(SubArgReset),
BootloaderDownload(SubArgBootloaderDownload),
ReadDID(SubArgReadDID),
NVMHardReset(SubArgNVMHardReset),
}

/// Download an application to an ECU
Expand Down Expand Up @@ -66,3 +67,9 @@ pub struct SubArgReadDID {
#[argh(positional)]
pub id: String,
}

/// Hard reset entire NVM including internal values
#[derive(Debug, FromArgs)]
#[argh(subcommand, name = "nvmHardReset")]
pub struct SubArgNVMHardReset {
}
13 changes: 13 additions & 0 deletions conUDS/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ async fn main() -> Result<()> {
let id = u16::from_str_radix(&did.id, 16).unwrap();
let _ = uds_client.did_read(id).await;
}
ArgSubCommands::NVMHardReset(_) => {
debug!(
"Performing NVM hard reset for node `{}`",
args.node
);
match uds_client.routine_start(0xf0f0, None).await
{
Ok(resp) => {
},
Err(e) => {
}
}
}
}

app.lock().unwrap().exit = true;
Expand Down
2 changes: 1 addition & 1 deletion conUDS/src/modules/uds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl UdsClient {
.await?
.await
{
Ok(resp) => debug!("Start routine response: {:02x?}", resp),
Ok(resp) => info!("Start routine response: {:02x?}", resp),
Err(e) => {
error!("When waiting for response from ECU: {}", e);
return Err(e.into());
Expand Down

0 comments on commit fc653b2

Please sign in to comment.