So I wanted to see what kind of delay the built-in bootloader of the Nano v3.0 clones I have was causing, so I created a small sketch which basically sets up a pin as output and turns it on. I then attached my logic analyzer and measured the time from reset is released until the pin goes high.
Here is the measurement of the sketch, uploaded through the serial port, meaning through the bootloader, meaning bootloader is active:
So here, from I release the reset, until the test pin goes high, is a delay of ~1,46 seconds.
And now, with the sketch uploaded through ISP/ICSP, meaning bootloader is now destroyed (and board cannot be programmed through serial port unless a new bootloader is added):
So now, from I release reset, until the test pin goes high, is a delay of 70 ms. Purrty big diffewence!
You can verify that the bootloader is now gone by checking the red LED on the board. When power is applied, it will blink once during startup (that’s the bootloader) and then do whatever your program does afterwards, so if it doesn’t, the bootloader is gone.
Now there are other bootloaders available, much faster ones also, but this is the one built into all clone Nanos I’ve worked with.
Turning the Arduino Nano clone into a programmer
So in case you don’t have a programmer (ISP) you can turn one of those Arduinos you have in the drawer into one! The Arduino IDE has a sketch that can be uploaded to any Arduino basically and make it act like a programmer, which you can then use to program sketches directly into other Arduinos, thus removing the bootloader, and reducing boot time dramatically. Here’s how to do it for a Nano:
Start the IDE, press “File“, press “Examples“, choose “11. ArduinoISP” and then “ArduinoISP“. It will then load that sketch. Press “Tools“, press “Board“, select “Arduino Nano“. Press “Tools“, press “Processor“, select “ATmega328P (Old bootloader)“. The “Old bootloader” versions have been the ones I needed to select for all clones I’ve used. You also need to select the serial port it is attached to in “Tools“. Press “Upload” to put the sketch in. You should now have an Arduino ISP. To get a stable connection, it is necessary to add a ~10uF capacitor between the RST and GND pins (negative on GND, positive on RST) on the Arduino ISP. Like this:
This is a hardware-hack to circumvent the Arduino from resetting when the serial data from the computer arrives. It is important that this is done after the ArduinoISP sketch has been uploaded.
Now to use your new programmer, open the sketch you want to write, select the correct board of your target (in this case no difference), and in “Tools“, press “Programmer“, select “Arduino as ISP” (note: NOT “ArduinoISP”, as that is a separate piece of hardware). The serial port should be the same as your Arduino programmer is connected to. You then need to connect the following with jumper cables (programmer -> target):
D10 -> RST
D11 -> D11
D12 -> D12
D13 -> D13
5V -> 5V
GND -> GND
So quite easy for Nano -> Nano.
Then write the sketch by pressing “Sketch“, select “Upload using programmer“. It should upload the sketch to the target, which now has zero bootloader, thus boots close to immediately. To reclaim the bootloader (or change it to another), simply press the “Burn bootloader” in “Tools“.
[…] for programming. A cheap ISP can be made with another Arduino Nano, check out how to do that here: https://immerhax.com/?p=480 (scroll down a […]