cancel
Showing results for 
Search instead for 
Did you mean: 

Software reset (cold reboot)

shabbyx
Associate II
Posted on November 15, 2013 at 18:36

Hi,

I'm looking for the proper (standard?) way for cold rebooting an STM8. I see that the first interrupt handler in the interrupt vector is what is called on startup. With my COSMIC compiler, the name of that function is

_stext

.

My thought was that the _stext function would initialize the stack pointer and various other registers, so calling it as a function from inside the program would result in a cold reboot, but testing it, apparently this is not true. In the very least, it seems like it doesn't reset the peripherals.

I saw another post that suggested a hack where the watchdog was enabled and then the program waited until it expired and reset the microcontroller. I'm looking for a more appropriate solution though. Does the micro support any way for being reset by software?

Shahbaz

#reset
2 REPLIES 2
fggnrc2
Associate II
Posted on November 15, 2013 at 21:09

Shahbaz,

this instruction:

WWDG_CR = 0x80;

resets a STM8 microcontroller.

It activates the Window Watchdog, which resets all because its seventh bit is null.

See page 127 of  RM0016 (STM8S and STM8AF microcontroller family) for more details.

Regards,

EtaPhi

shabbyx
Associate II
Posted on December 11, 2013 at 14:45

Thanks EtaPhi, that did the trick!