Feather M0 - Software Reset into Bootloader

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
AlexBussiere
 
Posts: 4
Joined: Wed Apr 13, 2016 2:33 pm

Feather M0 - Software Reset into Bootloader

Post by AlexBussiere »

I was wondering if there is a way, in software, to trigger a restart into bootloader mode. My board is mounted inside of an enclosure, and getting access to the reset button is kind of a pain. I know there is a way to call a function to reset the SAMD, but this is just a reset into normal operating mode.

Any help would be really appreciated

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather M0 - Software Reset into Bootloader

Post by adafruit_support_mike »

You mentioned both bootloader mode and normal operating mode as targets. Those are different parts of the reset/execute process.

Which one are you trying to reach?

User avatar
AlexBussiere
 
Posts: 4
Joined: Wed Apr 13, 2016 2:33 pm

Re: Feather M0 - Software Reset into Bootloader

Post by AlexBussiere »

The main target is to have a function that brings the device into boot loader mode. Resetting the device in software is not a priority. I have an LCD sending commands to the Feather M0 that is buried inside of an enclosure. I can easily make a button call a function to trigger boot loader, just can't find anything for this device to do that. Any help would be appreciated

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather M0 - Software Reset into Bootloader

Post by adafruit_support_mike »

If you're willing to use a GPIO pin to trigger the reset, this circuit will do the job:
reset.jpg
reset.jpg (12.25 KiB) Viewed 286 times
Configure the GPIO pin as an input until you want to force a reset, then configure it OUTPUT, HIGH.

The pin will turn on the transistor, which will pull the RST pin low. The 100nF cap will hold the transistor on for a short time after the reset starts, so you don't get wierd behavior from the GPIO pin being released and RST going high again.


Doing a hard reset in software is more of a challenge. You'd have to dig into the system registers and see if the SAMD21 architecture allows you to set the necessary flags to make a software reset (NVIC_SystemReset()) reboot all the same things as the external reset pin.

User avatar
AlexBussiere
 
Posts: 4
Joined: Wed Apr 13, 2016 2:33 pm

Re: Feather M0 - Software Reset into Bootloader

Post by AlexBussiere »

Will this trigger it to go into bootloader mode?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather M0 - Software Reset into Bootloader

Post by adafruit_support_mike »

Yes. That circuit will pull the physical RESET pin low, just like pushing the reset button.

User avatar
AlexBussiere
 
Posts: 4
Joined: Wed Apr 13, 2016 2:33 pm

Re: Feather M0 - Software Reset into Bootloader

Post by AlexBussiere »

Ok but for the Feather M0, the reset button has to be pressed twice. A single pull down of the reset pin will only reset it. Is there any software flags that the bootloader is looking for? I know some versions of bootloaders will check for a flag ( I am thinking of the SD card bootloaders available for the 328 and 2560 Mega micros) ?

If not, I would highly recommend adding this feature to the bootloader in the future. Embedding the feather in an enclosure is very limited by needing to hit the reset button twice. I will have to add a button to the enclosure for the reset button.

Thank you!

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather M0 - Software Reset into Bootloader

Post by adafruit_support_mike »

Ugh.. you're right. You'd need a pulse generator and an edge detector, something like this:
double-pulse.jpg
double-pulse.jpg (12.89 KiB) Viewed 241 times
The diode will pull the inverter's input pin low, sending its output high. The inverter's output will remain high until the capacitor charges past the inverter's high threshold, which will take about 300ms for the component values given.

The inverter's output goes to one side of an XOR gate and a delay network. The XOR's output will normally be low, but when a pulse arrives, it will go high during the delay. For the values given, that should produce low pulses about 100ms long on the rising and falling edges of the inverter's output pulse.

The XOR's output then goes to another inverter, which turns the two high pulses into two low pulses, suitable for putting the SAMD21 into bootloader mode.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”