1

The Adafruit Feather SAMD21 takes about two seconds from power being supplied to when setup() starts running. How can I shorten that time so that setup() will run sooner? I measure this time using a power supply and others appear to measure similar times with their eyeballs.

I understand that 328 microcontrollers can be made to boot quicker (almost instantly from a human perspective) using different bootloaders for example, but I haven't found one for the M0 SAMD21 nor another method.

The code isn't relevant because the blink example shows the same timeframe, but here's another example:

//no libraries, global variables, nothing.
setup(){ 
digitalWrite(LED_BUILTIN, HIGH);
}

loop(){ }

rfii
  • 170
  • 6

1 Answers1

1

After consulting the datasheet for the SAMD21, I verified that the processor starts immediately once the internal clocks are stable. This happens quickly. The reset vector directs execution to the Arduino bootloader, which certainly spins while waiting for the Arduino programmer to connect. If that does not happen during that delay, the bootloader jumps to the resident application. The delay with no activity is how the bootloader determines that you want to start the application. You can eliminate that by programming the processor using a hardware programmer/debugger, and getting rid of the Arduino bootloader.

The hardware programmers also allow source level breakpoint debugging. You just have to learn to use a decent IDE programming environment. A good prgrammer will cost you around $160.