Main Menu

Boot Time

Started by arf, October 25, 2021, 11:32:33 PM

arf

Does the Moteino USB boot fairly instantly?

Felix

To better answer your question I'd need more context but in general, if the bootloader is triggered by a reset (like in the case of MoteinoUSB being plugged in and the FTDI chip asserting the DTR signal) then the bootloader runs with a blink sequence, then it does a few checks, then jumps to the main program. To a human that is fairly instantly.

arf

I meant the time between when a battery is plugged in and when setup() starts running.  Seemed to be about 2 seconds on the M0 Moteino.  Are you saying the Moteino USB would be faster in that situation and boot fairly ?instantly

Felix

#3
Indeed about a 2s power-on bootloader delay on MoteinoM0. And about the same on MoteinoUSB when you power it at GND-VIN - but upon power-plugging to USB the DTR signal will start polling the FTDI and reset the chip which will result in further delay (this is seen by the several onboard LED blinks).

There is however a possibility to make a mod to the board to obtain the instant boot you're after, while also allowing the DTR signal to reset the board into bootloader for reflashing. It involves removing one 1uF capacitor and moving one 0.1uF capacitor, see below. To note that this is only if you apply power to GND-VIN to power the board, but when you power through USB the board would still get DTR'd into the bootloader for a short ~2s delay, or if you RESET the board. Similarly, this mod could be made on a regular Moteino R6 board, to the left-most 2 capacitors, same change as in the photo below, and when GND-VIN power is applied it should instantly run the main firmware.


arf

That's awesome!  thanks so much

brandock

This makes me wonder: what is the advantage of the .1uF cap between RST and GND in the OEM design?

Also, why does it work? I was trying to learn about it with some searches and ran into this reply for Spence Konde to a similar question about a cap between RST and GND and his response was "any cap between Reset and Gnd will prevent DTR reset trick from working."

https://forum.arduino.cc/t/adding-a-capacitor-between-ground-and-reset-pin/510387

Felix

It works for sure, or we'd hear about a lot of reset into bootloader issues.
Not sure I have a very detailed answer here but I do remember an app design recommendation many years ago which I followed and I know other similar designs used it as well.
There is also the 10k pullup which is necessary. I scoped all this DTR at one point and it all looked good to me.
Look at this video too, where a cap is mentioned.

brandock

I think I read somewhere that it help debounce the reset button, having that cap to ground and a resistor.

I agree the circuit works, because I use it every time I program a Moteino. Just curious if it makes sense to include in future circuit designs.

Maybe the trick is that it has to be a small-value cap. 10uF, for example, is used to bypass the reset for "Arduino as ISP".


Felix

Right. I do include this in other custom designs as well and haven't had problems with it.
I think 10uF would be way too much. I've always just used 0.1uF.