(Release) Reset hardware

I wanted to restart hw if any of the Setup was not installed correctly. I came up with a simple solution like this:

Hardware.h

#pragma once

class Hardware final {
public:
	Hardware() = delete;

	static void Reset() {
		asm volatile("  jmp 0");
	}
};

Usage

#include "Hardware.h"

int setup() {
    if(false)
        Hardware::Reset();
}

I wanted to share it, maybe someone needed.

Why not just use the watchdog?

(Yours is not a reset, simply a jump via the reset vector)

I agree with SemperIdem that with "asm volatile(" jmp 0")" you make soft reset. But as I understand with the watchdog you also will reach only software reset.
I found out that in order to make hardware or external reset you should use reset pin or reset button.
And I also looking for some way to make this reset in other way.

Idea may or may not work,
Use another pin to pull the reset pin LOW.

The datasheet for the 328 says the watchdog "gives an interrupt or a system reset"

I couldnt way to do hardware reset from software at all, even i couldnt for shutdown.

This is what I use. Someone posted it a decade or so ago. As pointed out, to do a hardware reset, either toggle the reset line (a digital output will work) or use the watchdog timer.

void(*reboot) (void) = 0;  //reset function

...

reboot();

This is basically same with what i post

Just enable the WDT, and do an infinite loop.

...but without the pointless class

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.