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

Watchdog intterupt mode #552

Open
JonasFocke01 opened this issue May 27, 2024 · 1 comment · May be fixed by #556
Open

Watchdog intterupt mode #552

JonasFocke01 opened this issue May 27, 2024 · 1 comment · May be fixed by #556
Labels
hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal help wanted Extra attention is needed

Comments

@JonasFocke01
Copy link

JonasFocke01 commented May 27, 2024

Hello,

i have a intentional deadlock, that is resolved by the watchdog of the arduino. The deadlock occurs, because i want my arduino to restart, if my host computer crashes (happens quite frequently...). The watchtog restarts the board, but i also need to keep some variables accross this restart. I could resolve my issue, if i could set the watchdog to interrupt-mode, as that would tell it to not restart the board and give me time to do something about it, but i have not found a way to do that.
Is this possible with this crate?
If yes, it would be very cool, if you could hint me in the right direction!
If not, see this as a friendly feature request.

Regards, Jonas

Edit: This is the atmega doc on setting watchdog to interrupt mode (page 65)

@Rahix
Copy link
Owner

Rahix commented May 31, 2024

Unfortunately, this is not yet supported in the HAL. You can of course implement this by directly interfacing with the registers, but there is no nice abstraction for it yet...

Let's use this issue to track implementation of this feature. I guess the best way to do this is adding a second constructor next to the existing one which enables the watchdog with interrupt-mode instead of soft-resetting the MCU.

pub fn new(mut p: WDT, m: &WDT::MCUSR) -> Self {
p.raw_init(m);
Self { p, _h: PhantomData }
}

@Rahix Rahix added help wanted Extra attention is needed hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal labels May 31, 2024
@JonasFocke01 JonasFocke01 linked a pull request Jun 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hal-api API design for the different components of avr-hal hal-generic Related to MCU generic parts of avr-hal help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants