I am building some boards around the SAMD21G18. We are currently loading the Arduino bootloader and using the IDE to program them via USB, and we are facing delays in the startup of our program of around 5 seconds. The blink sketch is enough to trigger the issue, so I discarded waits caused by serial initialization or waiting for other HW to be ready.
I was wondering if the issue is caused by the bootloader. Do you experience also long delays in your boards? I don't have any zero boards available to compare. I checked power, as we are using a magnetic switch to power the uC, but the 3.3V line is almost instantly ready after the magnet is present, but we still have this delay.
I have an Atmel ICE programmer, is it possible to get rid of the bootloader? will that get us the instant boot that we need?
The "native USB" bootloaders tend to take longer because they need to wait for the PC to finish USB enumeration before they can attempt their "pseudo-serial" communications.
(or did you mean 5 seconds between the end of download and actual sketch start? The delay I refer to would be in startup of a sketch that had been previously downloaded.)
Thanks for your prompt response.
I use a custom board. The delay is the time it takes for the sketch to start upon connecting it to power. I mean, I connect it to power, and then I have to wait 5 seconds for my sketch to start.
I experimented a bit, and found that it's possible to import Arduino sketches into Atmel Studio, and I think (although I'm not 100% sure) that I managed to flash the sketch without a bootloader, and the blink sketch has a delay around the 3s from powering it to start blinking.
Power is applied through a DC power cable, no PC or USB was used to apply power. USB it's only used for debugging.
There should be no delay between power up and the basic blink sketch. Are you sure the chip operating at correct clock speed?