Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • I check MCUSR register right after start to identify the source of reset/power up. Now I've tried this way of reset (void sw_reset(){asm("jmp 0x0");}). It's works, but - as i disassembled - it just resets the stack pointer, which results to start the program again from the main(), but port, timers, UART settings are remains Commented Feb 1, 2019 at 10:11
  • 1
    @DankóDávid So you don't want to restart it? Maybe it's an XY Problem? Commented Feb 1, 2019 at 10:22
  • Note also that a hardware reset sets all the I/O registers to their initial value, which a jump to 0x0000 doesn't. Only very few registers, like MCUSR have no defined initial value. Commented Feb 1, 2019 at 10:26
  • @EdgarBonet yes, that might be a problem in the middle of TWI communication or so. But initialization code should be written as there is already something configured. Definitely in this case. Commented Feb 1, 2019 at 10:33
  • I've edited the question and added an example what the exact problem i trying to solve. 1) I already use the watchdog timer to detect malfunction. 2) I'd like to reset the AVR completely (resetting all function register what the recovery function touched and i can't track), but the only way i've found is to use WDT timeout which results not just to restart, but to recognise as a "malfunction restart". More simplified: I need a malfunction reset (WDT) and an intentional software reset, which not share the same mechanism of reset. Or differentiate the two way of resetting the AVR. Commented Feb 1, 2019 at 21:47