Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Feather M0 spontaneously going into bootloader mode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Feather M0 spontaneously going into bootloader mode

by reschue on Tue Mar 10, 2020 9:28 pm

Agreed. One would think the brownout circuit would properly wake up the CPU, but the software must be seeing something during the slow power up that makes it think you want it to stay in bootloader mode.

Good luck,
Rick

reschue
 
Posts: 35
Joined: Sun Jun 17, 2018 4:36 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Tue Mar 10, 2020 10:13 pm

I wonder if it’s the double reset they try to detect. I need the source code.

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by reschue on Tue Mar 10, 2020 10:42 pm

I think you're on to something. I took a quick look at the nrf52 bootloader code on GitHub and it makes sense that a slow voltage ramp may trigger the brown out detector into generating a duplicate reset event during the double reset time interval. The M0 code is probably very similar.

So if you did have the source, what would you do? Change the double reset interval (longer/shorter)? I'm assuming you still want the functionality of the bootloader and access to the development tools that use it. Otherwise you may still need a hardware solution (clean up the power on ramp, or externally force a reset until the power is good).

reschue
 
Posts: 35
Joined: Sun Jun 17, 2018 4:36 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Wed Mar 11, 2020 12:55 am

I'd probably change it to only trigger on a pin being pulled high or low, or maybe with a timeout that launches the application if no flashing activity occurs first.

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Wed Mar 11, 2020 3:52 am

I think I found the UF2 repo, and I wrote an issue against that.

The code is treating anything other than a power-on reset (POR) as a reset that counts toward the double-click. Now I gotta figure out how to burn a modified bootloader onto this board.

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by danhalbert on Thu Mar 12, 2020 3:22 pm

@reschue We want to figure out which bootloader you have on the board. The Feather M0 Basic has in the past shipped with Arduino-only style bootloader, but might be shipping now with the UF2 bootloader, which is upward compatible. I am not sure what is being loaded on

When you plug in the board and double-click the reset button, getting a slow pulse on the red LED, do you see a FEATHERBOOT drive appear? If you do, then it has the UF2 bootloader. If not, it has the Arduino bootloader.

The fast pulse with no USB means that the bootloader can't connect to USB; slow pulse means it is connected. That make sense given your initial reports.

danhalbert
 
Posts: 1966
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 12, 2020 4:10 pm

@danhalbert If you're asking me if it's UF2 firmware, then I can say this happens with both the UF2 and the Arduino-only style bootloader. I haven't been able to find the source code for the Arduino-only boot loader. I'd like to, since I want to verify the behavior is what I'm seeing, but it seems to happen with both.

Has anyone looked at my bug report here: https://github.com/microsoft/uf2-samdx1/issues/88

Would it be better for me to file it against the Arduino fork of the repo?

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 12, 2020 4:15 pm

I went ahead and filed it against the Adafruit repo: https://github.com/adafruit/uf2-samdx1/issues/108

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Sat Mar 14, 2020 4:31 am

I've found and fixed this for SAMD21 with this PR: https://github.com/microsoft/uf2-samdx1/pull/89

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by danhalbert on Sat Mar 14, 2020 9:05 am

Thank you! I'll incorporate something like this in the round of bug fixes I'm currently working on. I'm still debugging the intermittent random zeroing of flash locations.

danhalbert
 
Posts: 1966
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Sat Mar 14, 2020 9:18 am

Yikes! When does that happen?

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by danhalbert on Sat Mar 14, 2020 11:57 am

It happens very infrequently on M4 boards when power-cycled.

danhalbert
 
Posts: 1966
Joined: Tue Aug 08, 2017 12:37 pm

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Sat Mar 14, 2020 4:08 pm

Oh wow, that's scary. Any chance it's related to this (BOD reset triggering the boot loader)?

jetforme
 
Posts: 60
Joined: Mon Jul 15, 2013 6:26 pm

Re: Feather M0 spontaneously going into bootloader mode

by danhalbert on Sat Mar 14, 2020 4:16 pm

It's not clear, but the question is what is causing the flash to be erased? Usually a few bytes just past the BOOTPROT protected region are written. It may be a bug in the bootloader, or it may be some kind of obscure hardware problem. Very oddly, it seems to depend on what is in the user program. Fortunately it's pretty rare. I have been working on this for several days to get a minimal test case, but haven't gotten closer to figuring out exactly why it's happening.

danhalbert
 
Posts: 1966
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.