Page 1 of 1

reset software

Posted: Sat Jun 05, 2021 4:01 am
by frankz
is it possible to reset the board (or mcu) by code, instead of pressing the connected pin "reset" button?

Re: reset software

Posted: Sat Jun 05, 2021 6:10 am
by ag123
try

Code: Select all

HAL_NVIC_SystemReset();
or

Code: Select all

nvic_system_reset();

Re: reset software

Posted: Sat Jun 05, 2021 11:50 am
by mrburnette
frankz wrote: Sat Jun 05, 2021 4:01 am is it possible to reset the board (or mcu) by code, instead of pressing the connected pin "reset" button?
The fact that it "can" be done does not mean that it is a good idea. In-code resets are not identical to hardware resets; thus, you can leave registers and I/O pins in an unknown state. Some "core" implementations do have hardware calls which simulate the hardware reset-button line but you must remember such code is chip-specific.

Re: reset software

Posted: Fri Jun 11, 2021 1:43 am
by dannyf
1) use the watch dog timer(s) - if you don't feed the watch dog, it resets the device;
2) use a gpio pin to pull down the mcu line;
3) jump to the reset start address - not a full reset, however.
4) call the device start-up routine, often _main().
5) call the reset handler. for CMSIS-based environment, that's default_reset_handler() in the start up file.
6) call SystemInit() - not a true reset
...

aka lots of ways to get varying degrees of "reset-ness".