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(){
}
asked Nov 13, 2021 at 4:44
2
  • I dont think that is relevant because other people observe the same start time. Anyway here it is, apologies for the formatting setup(){ digitalWrite(LED_BUILTIN,HIGH);} loop(){} There is nothing else before or after. The standard Blink example shows the same thing. Commented Nov 14, 2021 at 19:45
  • Measured with a power supply. Other people observe about the same time. Commented Nov 14, 2021 at 19:46

1 Answer 1

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ドル.

answered Jan 12, 2022 at 23:59
2
  • 1
    I have no idea why this would be "voted down" since it is a valid and appropriate solution to the op's question. Commented Jan 13, 2022 at 13:49
  • Awesome idea and research! Thanks. Do you have link to the type of programmer and IDE or what you mean by removing the bootloader? Perhaps this? learn.adafruit.com/how-to-program-samd-bootloaders Commented Jan 21, 2022 at 3:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.