How best to reset the CPU under program control?

Comments

2 comments

  • Avatar
    Dr Danish Ali

    If you have a spare watchdog then enabling-and-abusing this can cause a reset.

    But note that on stm32f4xx this is not as thorough as a power-on-reset. (I have seen this when read-protecting the FLASH).

    At reset the arm processor loads its stack pointer and program counter from the vector table. So you might be able to do the same with a bit of assembly code. You will need to ensure that you have the _correct_ stack pointer active!

    If the processor has different oscillator options then you might also have to put the processor back into its default oscillator mode before vectoring to the startup code (as that will assume it is in the default mode when switching to a faster mode).

    Hope this helps,

    Danish

    0
    Comment actions Permalink
  • Avatar
    Richard Webb

    It's highly processor dependent. Danish's suggestion to force a watchdog reset is probably the best universal solution. As he also notes, there may be some components that only reset as a result of a real power-on reset.

    Cortex M3 devices can use the SYSRESETREQ bit in the application interrupt and reset control register to request to "force a large system reset of all major components except for debug." 

    0
    Comment actions Permalink

Please sign in to leave a comment.