How to software reset SAMD20

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

When my main app is running, I want to fall back to bootloader. To do that I set some flags  in flash then issue a software reset. I googled on how to software reset SAMD20 and it turns out that I have to reset the core by writing to the AIRCR reg. This is where I got the info:

 

cortex user guide

 

However the s/w reset is resulting in a hardware fault. 

 

This is my code:

(*(uint32_t*) 0xE000ED0C) = (0x05FA << 16) | 0x04;

It looks like that address is not mapped? Is there some other way to reset SAMD20 using start project?

 

thanks for your help

This topic has a solution.
Last Edited: Fri. Oct 27, 2017 - 02:45 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Probably the best way out is to use the WDT timer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

NVIC_SystemReset?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

NVIC_SystemReset?

Did this work?

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I ended up using WDT. I let it overflow and reset the system.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

YogiWannabe, could you send me any example?

I am with the same problem.

Thank you!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what's wrong with the methods of #4 & #5?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I setup WDT in Atmel Start project then I called this function. For some reason when I try to add code, browser just hangs....

void software_reset_mcu()
{
    uint32_t clk_rate;
    uint16_t timeout_period;

    clk_rate       = 1000;

    timeout_period = 8192;
    wdt_set_timeout_period(&WDT_0, clk_rate, timeout_period);
    wdt_enable(&WDT_0);
    while (1)
    ;
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mia.dawson wrote:
For some reason when I try to add code, browser just hangs....

What "browser" are you talking about??

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
What "browser" are you talking about??
I believe (s)he is referring to the known forum bug of trying to use the <> button here.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

my SAMD21 can perform a software reset by executing the following line: NVIC_SystemReset();
You may also want to look up this in-built function (NVIC_SystemReset). It is in file core_cm0plus.h.

In my application I use a bootloader + main app code. All this stuff only works correctly when following this sequence:

- of course first erase the microcontroller and program the bootloader into it.

- program the main app code into the microcontroller in a higher memory region.

- unplug the program adapter (I use J-Link).

- important: power the microcontroller off and then on again. Without giving the microcontroller a clean restart after having programmed bootloader + main app, the soft-reset will not (always) work later on.

Cheers!

Last Edited: Wed. Jan 31, 2018 - 04:53 PM