Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: panic-probe reset device on panic #868

Open
Gibbz opened this issue Sep 28, 2024 · 4 comments
Open

Request: panic-probe reset device on panic #868

Gibbz opened this issue Sep 28, 2024 · 4 comments

Comments

@Gibbz
Copy link

Gibbz commented Sep 28, 2024

I'm using panic probe with embassy rust. It's supposed to reset the device when there is a panic.
The logging part is working fine, however the device stays stuck after the log. There is no reset.

Is there some extra setting required to cause it to reset after the log?

Edit: make this a feature request or it can be closed.

@Urhengulas
Copy link
Member

It's supposed to reset the device when there is a panic.

Is this documented behavior of panic-probe? I don't recall that it is supposed to do that.

But I think it would be possible to add a cargo feature which does configure it to do a reset.

@Gibbz
Copy link
Author

Gibbz commented Sep 30, 2024

Ah! Okay maybe it's not. I was trying to use a crate to do this and it was giving me a warning saying panic probe does this.

I've done it manually for now. But I'll leave this open as a feature request then.

@Gibbz Gibbz changed the title panic probe not resetting device Request: panic-probe reset device on panic Sep 30, 2024
@Urhengulas
Copy link
Member

Is it possible you could share your workaround? As a reference for others and maybe an implementation

@Gibbz
Copy link
Author

Gibbz commented Oct 10, 2024

I used the following

use core::panic::PanicInfo;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
    cortex_m::interrupt::disable();
    defmt::error!("Panicked: {}", defmt::Display2Format(info));
    //panic_persist::report_panic_info(info);
    for _ in 0..2_000_000 { // delay before reset
        nop()
    }
    cortex_m::peripheral::SCB::sys_reset();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants