Skip to main content
Visitor II
March 14, 2007
Question

Software reset

  • March 14, 2007
  • 10 replies
  • 2690 views
Posted on March 14, 2007 at 04:39

Software reset

    This topic has been closed for replies.

    10 replies

    faAuthor
    Visitor II
    February 14, 2007
    Posted on February 14, 2007 at 09:55

    Hello,

    I am trying to make a software reset, after reprograming the flash. But it is not working every time.

    The function look like this:

    __ramfunc void Reset(void)

    {

    RCCU->CCR |= RCCU_EN_HALT | RCCU_SRESEN;

    RCCU->SMR |= 0x02;

    }

    Interupts are disabled.

    Best regards, Frank

    Visitor II
    February 14, 2007
    Posted on February 14, 2007 at 15:02

    Just a shot in the dark: try putting a small delay (a few NOPs) between the two lines of code.

    There is another way to reset the MCU in software: the watchdog timer.

    - mike

    Visitor II
    February 16, 2007
    Posted on February 16, 2007 at 04:34

    I need to reset an STR711 too. I tried setting those bits in RCCU_CCR,

    then Halt in RCCU_SMR, but it doesn't appear to work. It just looks

    dead - no LEDs, and the USB stack can't communicate with it.

    I say doesn't appear to, because the firmware I have would possibly

    give the same result if a message were sent over USB after the

    recovery from reset. I shut down the controlling USB application

    immediately it has issued the command to restart, so I'm not

    voluntarily sending any message, but USB stacks are complex and I

    don't know if mine is doing something.

    I'm going to try the watchdog method next - thanks for the creative

    idea!

    Dave

    Visitor II
    February 16, 2007
    Posted on February 16, 2007 at 08:40

    Following up my own posting: I have tried the watchdog method of resetting

    the STR711, but I can't even get that to work. I have:

    // Set the watchdog timer going in order to generate a reset

    // The clock prior to the prescaler is 32 MHz; the

    // prescaler divides by 256, so the prescaler's output

    // is at 125 kHz (8 us period)

    WDG_CntReloadUpdate (10000); // 80 000 us = 80 ms

    // Having set the reload value, restart the watchdog

    WDG_CntRefresh ();

    // Now enable it

    WDG_Enable ();

    GPIO0->PD = GPIO0_INIT_MASK & 0xFFF0;

    while (TRUE);

    The ''GPIO0->PD = GPIO0_INIT_MASK & 0xFFF0;'' lights up some LEDs to let

    me know that the code has got there - and it has. That's beyond doubt.

    But the thing doesn't reset; it just sits there with some other LEDs

    cycling, which is how I left it prior to trying to induce the reset.

    As far as I can see, it's impossible for that code to fail; it MUST

    cause the chip to reset. But it doesn't.

    Any ideas would be gratefully received!

    Dave

    Visitor II
    February 22, 2007
    Posted on February 22, 2007 at 04:51

    What exactly do Software Reset and Watchdog Reset do within the STR711?

    Do they reset all the peripherals, as if the hardware reset line had

    been asserted?

    This isn't clear to me from the Reference Manual.

    Dave

    Visitor II
    February 22, 2007
    Posted on February 22, 2007 at 14:52

    Quote:

    What exactly do Software Reset and Watchdog Reset do within the STR711?

    Do they reset all the peripherals, as if the hardware reset line had

    been asserted?

    This isn't clear to me from the Reference Manual.

    I have the reference manual revision 8, and to me it's clear that software reset and watchdog reset have the same effect as hardware reset. At least on paper they do. You never know what actually happens in real hardware :)

    - mike

    Visitor II
    March 2, 2007
    Posted on March 02, 2007 at 17:30

    hello,

    Ys Software reset and Watchdog Reset have the same effect as hardware reset. an example of watchdog generating a reset is provided with the STR71x software library. what is confusing in refrence manual?

    ;)

    Visitor II
    March 12, 2007
    Posted on March 12, 2007 at 13:38

    Hi.

    I noticed this post was started a month ago so I don't know if my input will be of any use, but have you tried to jump to start of your code instead of a reset. i.e.

    define

    void (*jump_function) (void);

    and in your 'reset' function:

    jump_function = (void*) 0x40000000;

    jump_function();

    or wherever it is your code is stored.

    Regards

    Neil

    Visitor II
    March 13, 2007
    Posted on March 14, 2007 at 00:56

    Yes, I'm always using assembly code to do software reset and it works fine.

    soft_reset

    mov pc, #0x40000000

    Visitor II
    March 14, 2007
    Posted on March 14, 2007 at 04:39

    Jumping to the reset vector will work, but you have to be careful as it is not the same as a proper reset, in that registers/interrupts will not be reset. At the very least I would disable any enabled interrupts before jumping to the reset vector. There is also a section in the datasheet (EIC IRQ notes) that is worth reading if you are going to do this.