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.

Feather M0 spontaneously going into bootloader mode

by jetforme on Mon Mar 02, 2020 4:22 am

I've got a Feather M0 basic board running in a circuit with an Adafruit solar charge controller and some LEDs. If left alone to run for a couple of days and the battery discharges all the way to cutoff, and then the sun comes up and recharges things, sometimes (it's not clear when), the Feather will go into a mode where the red LED pulses (fading off-on, not blinking off-on) rapidly (2-4 Hz). This is a faster pulse than the bootloader mode. However, if I attach a USB cable, it switches to a slow pulse mode, and the boot volume mounts (despite my efforts to flash the normal Arduino bootloader). From the CircuitPython docs here, that means it's in bootloader mode without USB connected (slow is with USB connected).

Can anyone tell me what's causing it to go into this mode? I'm assuming there's a voltage present on some pin when power is applied, or something like that. But I can't tell what. The DFU pin is grounded.

This is making the Feather really unreliable. I need to count on it booting back into its flashed Arduino program. (As an aside, how can I get the regular Arduino bootloader loaded, so that it doesn't always mount a disk volume when I plug it in?)

Thanks.

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

Re: Feather M0 spontaneously going into bootloader mode

by Mike1313 on Thu Mar 05, 2020 1:38 am

Hi, I think I am having the same problem. I posted my problem 1 week ago, but no reaction...
I have a MacBook Pro (2019) with only the USB-C ports. So I connected the Mac to my OWC (multiport) thunderbolt 3.0 dock to get some USB ports.
I think I blew up my feather M0 and M4 (within a few seconds). The dock may have given high voltage- or high current peaks(??) and may have damaged the boards...... Also, when connecting my mouse to this dock, it sometimes works. It may be an unreliable device.....
What do you think?

Mike1313
 
Posts: 23
Joined: Sat Nov 15, 2014 10:32 am

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 05, 2020 1:57 am

I have the same setup, but my devices aren’t damaged; they work just fine, aside from this issue (which happens when they’re not attached to my TB3 dock)

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

Re: Feather M0 spontaneously going into bootloader mode

by Mike1313 on Thu Mar 05, 2020 2:17 am

Any idea what my problem is?
https://youtu.be/qbSrB2LJe3o

Mike1313
 
Posts: 23
Joined: Sat Nov 15, 2014 10:32 am

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 05, 2020 3:03 am

No, sorry. I don’t have an M4. There’s a graphic somewhere that explains the circuit python boot loader LEDs.

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

Re: Feather M0 spontaneously going into bootloader mode

by Mike1313 on Thu Mar 05, 2020 4:16 am

I erased the board another time and better reading the Adafruit instructions, now it works. I am sorry to bother you as you are having other problems....

Mike1313
 
Posts: 23
Joined: Sat Nov 15, 2014 10:32 am

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 05, 2020 4:36 am

Glad you solved your problem!

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

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 05, 2020 8:51 pm

Hey Adafruit, can anyone respond to my original post please? I really need to figure this out. What are all the possible ways to trigger the bootloader?

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

Re: Feather M0 spontaneously going into bootloader mode

by jetforme on Thu Mar 05, 2020 10:41 pm

I found this document the SAMD21 boot process.

It says PA15 (Arduino pin 5) low enters the boot loader. But that depends on the actual bootloader code. Looking at the code here, it doesn't seem to check PA15, but I do use that pin via a timer to generate a PWM signal. You'd think in reset or from power on that PWM would be disabled, but maybe not?

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

Re: Feather M0 spontaneously going into bootloader mode

by reschue on Sat Mar 07, 2020 7:45 pm

OK, this may not have the slightest thing to do with your problem, but ...

I had a boot problem with a custom board I made based on the Bluefruit (nrf52) Feather board. Basically, it's a Feather with additional outputs to control two stepper motors, an extra serial port, and some push button switches.

I built five identical boards - all worked fine. Then after several weeks one of them would not come out of bootloader mode. I can program it (via the CP2104 USB port), but it doesn't run the program. Tried reprogramming it with a J-Link, with no better luck. Just sits there and slowly brightens and dims the red LED.

I noticed that on the boards that worked, the DFU and FRST pads were high (3.3V) unless you pressed the RESET button, then both when to ground. On the bad board, DFU followed RESET, but the FRST pad was always low.

With the power off, the DFU and FRST pads on the good boards indicated 50K to 100K Ohms to ground. On the bad board, FRST showed about 1000 Ohms to ground.

Turns out, I must have had some solder flux residue around the FRST pin under the Bluetooth (Raytac) module that held the pin "low". Unsoldering the module, cleaning up the pads and resoldering it solved the problem. Funny that this problem didn't show up for weeks after the board was assembled.

Your board is different from mine, but while you're waiting for someone with a better solution, see if you might have a hardware problem.

Regards,
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 8:37 am

I've tried this with the Feather M0 Basic that has that mass storage device firmware, and I've tried it with a Feather M0 BLE that just has the Arduino bootloader, and both exhibit this behavior. I'm able to reproduce it by giving it very dirty power (rubbing two wires from Batt+ to the input of the Solar Lithium Ion/Polymer charger - v2 (https://www.adafruit.com/product/390). Doing this for a bit seems to trigger the bootloader, and if power is stable after that, the bootloader never exits.

I think something like this is happening when the battery is depleted and the sun comes up, giving the charger barely enough power to start up. You can see the power/charge lights start flashing, and I bet that's screwing up the Feather M0 boot. I'm not sure how to address this.

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 12:07 pm

When the board is "stuck" in the bootloader, does giving it a hard reset fix the problem?

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 4:12 pm

Yes. Unfortunately I won’t be able to do that when it’s out in the field. It needs to run autonomously.

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 8:06 pm

Sorry, but it looks like you're going to need some external logic to RESET the Feather when the battery recharges.

Microprocessors (like all digital integrated circuits) don't behave predictably when operated below their specified voltage. So in situations where operating voltage can't be guaranteed, a supervisory circuit (usually internal to the micro) is typically used to "reset" the chip once the supply voltage reaches the minimal operating level. The problem is that the internal supervisor is also an integrated circuit and has a similar problem with low operating voltage unless some clever analog design tricks are employed.

If the internal power-up RESET circuit on the micro is not doing the job, you may need to add an external device to RESET the Feather upon battery recharge. Today, almost all of these supervisor chips are very small surface mount devices. It's hard to find a thru-hole chip still in production. One of these is the Dallas Semiconductor (now Maxim) DS1232. It's available through Digi-Key. I've used these for years. Unfortunately, it's a 5V chip and needs at least 4.5V to operate (maybe it can run off the battery, rather than the 3.3V from the Feather?).

This chip will assert RESET until the battery voltage reaches a minimum value (typically about 4.5V). It also has a "watchdog" function that requires the microcontroller to periodically pulse the STROBE input pin or it will pulse RESET output. This requires you to add some code to your program to tickle the DS1232 within this time limit (user adjustable from 150 msec to 1.2 seconds) - otherwise the DS1232 will "time out" and hit the RESET. The nice thing about the watchdog is that if the Feather fails to execute your code (for whatever reason) the DS1232 will hit RESET (without you having to push the RESET button). This might be a problem with the Feather if it takes longer than 1 second to boot and start running your program. (otherwise the DS1232 will hit the RESET before your program has a chance to strobe the watchdog).

Another solution would be an analog voltage comparator (an op-amp, a zener diode, and a couple of resistors) to monitor the battery voltage and assert RESET until the battery achieved a minimal operating voltage. This eliminates the watchdog strobe requirement of the DS1232, but requires a lot more effort to implement.

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 8:21 pm

The SAMD21 has brownout detect circuitry on board. Modern MCUs provide this precisely to avoid the need for external circuitry.

A better solution would be to fix the boot loader, as it’s what’s making the decision to stay active. I have to find the source for the arduino boot loader that’s on this board (it’s not the DFU loader that’s on the newer boards)

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

Please be positive and constructive with your questions and comments.