Flash latest bootloader on Arduino Nano China clone – Thing King – Technology & DIY (2023)

An Arduino Nano is very cheap to get directly from China. But often these boards still have an old bootloader on board. This article explains how to reflash the bootloader of the Nano with the help of another Arduino.

Notice:
This is a translation of the German article. Please note that especially menu names, button labels, names, screenshots etc. might not be translated (correctly). Feel free to let us know in the comments if you notice any errors.

Is the old or new bootloader installed?

To find out, connect your Arduino Nano to your computer via USB cable and open the Arduino IDE. Choose the following example sketch under File -> Examples -> 01.Basics -> Blink. Under Tools -> Board select “Arduino Nano” and under Tools -> Port select the corresponding port of your Arduino Nano. Under Tools -> Processor select “ATmega328P” (and not “ATmega328P (Old Bootloader)”) and start the upload of the sketch.

Upload successful?

If the sketch upload was successful, then the new bootloader is already installed on your Arduino Nano and you can stop reading at this point 🙂

Upload failed?

If you get an error message similar to the following, then your Arduino Nano has the old (or no) bootloader installed.

 Using Port : COM16 Using Programmer : arduino Overriding Baud Rate : 115200avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00avrdude done. Thank you.Beim Hochladen des Sketches ist ein Fehler aufgetreten

The error message can also contain other codes after “resp”, e. g.:

avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x85

Now select “ATmega328P (Old Bootloader)” under Tools -> Processor and start the upload of the sketch again. This time the upload should be successful and the LED on the Arduino Nano should blink. In the output window of the Arduino IDE you will see “Upload complete” and more details about the upload process, for example:

 Using Port : COM16 Using Programmer : arduino Overriding Baud Rate : 57600 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :[...] Programmer Type : Arduino Description : Arduino Hardware Version: 2 Firmware Version: 1.16 Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.00savrdude: Device signature = 0x1e950f (probably m328p)avrdude: reading input file "C:UsersuserAppDataLocalTemparduino_build_372348/Blink.ino.hex"avrdude: writing flash (924 bytes):Writing | ################################################## | 100% 0.29savrdude: 924 bytes of flash writtenavrdude: verifying flash memory against C:UsersuserAppDataLocalTemparduino_build_372348/Blink.ino.hex:avrdude: load data flash data from input file C:UsersuserAppDataLocalTemparduino_build_372348/Blink.ino.hex:avrdude: input file C:UsersuserAppDataLocalTemparduino_build_372348/Blink.ino.hex contains 924 bytesavrdude: reading on-chip flash data:Reading | ################################################## | 100% 0.22savrdude: verifying ...avrdude: 924 bytes of flash verifiedavrdude done. Thank you.

Now we know that the old bootloader is installed on the Arduino Nano. We can overwrite this with the new bootloader without any problems, because it is only a different software. The hardware of an Arduino Nano with the old bootloader is no different from one with the new bootloader. But why should we do this at all?

Differences of the new bootloader compared to the old one

The old bootloader is the “ATmegaBOOT”, the new bootloader is called “optiboot” and is also used in other Arduino models.

In this StackExchange post, the two main benefits are mentioned:

  • If the Arduino Nano is reset by the watchdog, then a bug in ATmegaBOOT causes the Arduino Nano to restart infinitely often. This bug does not exist in optiboot.
  • When uploading sketches ATmegaBOOT works with a baud rate of 57600. The bootloader optiboot on the other hand is twice as fast with a baud rate of 115200. So sketches can be uploaded to the Nano faster with the new bootloader. Since different baud rates are used, the correct bootloader must always be selected when uploading sketches in the Arduino IDE. From the bootloader’s point of view no useful data would be received otherwise, because the sketch is transferred too slow or too fast.

Another small advantage of the new bootloader is that you can use the default setting of the Arduino IDE and don’t have to remember to change the bootloader in the “Processor” menu accordingly.

Flashing a new bootloader to the Arduino Nano

To flash a bootloader to an Arduino, you need a “programmer”. This can either be a special board for this purpose or you use another Arduino for this task. If you have a second Arduino lying around, it is recommended to use it as a programmer, because then you don’t have to buy an extra (rarely used) programmer board.

In the following we use an Arduino Uno as programmer. We also need six male-to-female jumper cables and the Arduino IDE must be installed; because flashing bootloaders via the web editor is not possible.

Prepare Arduino as programmer (ISP = In-System Programmer)

First we load the software on the Arduino Uno, with which we will flash the bootloader of the Arduino Nano later.

  • Do not connect any jumper cables to the Arduino Uno yet.
  • Connect the Arduino Uno via USB cable to the computer.
  • Open the Arduino IDE (Note: Arduino create Web-Editor does not have the functions for bootloader flashing built in!) and load the sketch “ArduinoISP” via the menu File -> Examples -> 11.ArduinoISP -> ArduinoISP
  • Set the board and port settings according to the used Arduino model for the programmer:
    • Tools -> Board -> Arduino Uno
    • Tools -> Port -> Select port number of the Arduino Uno
  • Upload the sketch to the Arduino Uno.
  • If everything is uploaded successfully, your ISP Arduino is ready to go!

Wiring: Connect Arduino Uno (programmer) to Arduino Nano (bootloader target device)

In the next step, we will connect the Arduino Uno to the Arduino Nano using six jumper cables.

  • Ein Blick in den Code des “ArduinoISP”-Sketch verrät uns, wie wir den Arduino Uno (Programmer) jetzt mit dem Arduino Nano (Bootloader-Zielgerät) verkabeln müssen:
  • Disconnect the Arduino Uno (programmer) from the computer.
  • On the Arduino Nano (bootloader target device) there is a 2×3 pin block labeled “ICSP”. We will connect the Arduino Uno (programmer) to these six pins to flash the Arduino Nano’s bootloader. The ICSP pins are standardized and should have the same pinout on every Arduino model.
  • A look into the code of the “ArduinoISP” sketch tells us how to wire the Arduino Uno (programmer) to the Arduino Nano (bootloader target device):
Flash latest bootloader on Arduino Nano China clone – Thing King – Technology & DIY (1)
  • With the symbol ” ° ” it is indicated, which is pin 1, which should also be labeled with a “1” on the board.
  • On the fifth, unlabeled pin (in the sketch comment) is normally RST (Reset).
  • We now need to connect these six pins on the Arduino Nano to corresponding pins on the Arduino Uno. The source code tells us the pin number for the reset.
Flash latest bootloader on Arduino Nano China clone – Thing King – Technology & DIY (2)
  • Reset is triggered via pin 10.
    • Reset: 10
  • But which are the standard hardware pins for MOSI, MISO and SCK on the Arduino Uno? The pinout of the Arduino Uno tells us:
    • MOSI: 11
    • MISO: 12
    • SCK: 13
  • Furthermore we have to supply power to the Arduino Nano via the pins GND and 5V.
  • In summary we wire the Arduino Uno to the Arduino Nano as follows:
Arduino Uno
(programmer)
<->Arduino Nano
(bootloader target device)
5V5V (ICSP-pin 2)
GNDGND (ICSP-pin 6)
13SCK (ICSP-pin 3)
12MISO (ICSP-pin 1)
11MOSI (ICSP-pin 4)
10RST (ICSP-pin 5)
Flash latest bootloader on Arduino Nano China clone – Thing King – Technology & DIY (3)

On the Arduino page about ISP it is pointed out that with the Arduino Uno as programmer (and also with the Mega, Mini and Nano) an additional 10µF capacitor must be connected to the pins GND (minus (-), short leg) and RST (plus (+), long leg). The capacitor may only be connected after the ArduinoISP sketch has been loaded onto the board. In the following photo you can see the additionally capacitor in place:

Flash latest bootloader on Arduino Nano China clone – Thing King – Technology & DIY (4)

Note: However, the flashing process (see below) worked for me without the additional capacitor.

Start flash process

Now we can flash the new bootloader to the Arduino Nano.

  • Change the settings in the Arduino IDE in the Tools menu:
    • change Programmer to Arduino as ISP (choose exactly this entry and not “ArduinoISP” or “ArduinoISP.org”)
    • under Port select the port number of the Arduino Uno (programmer)
    • under Board and Processor set the parameters for the “target Arduino” where we want to reflash the bootloader, so in this case:
      • Board: Arduino Nano
      • Processor: ATmega328P (and not “ATmega328P (Old Bootloader)”)
  • In the menu Tools click on Burn Bootloader. (Since no sketch is uploaded here, but the bootloader is transferred via the ArduinoISP program of the Arduino Uno, it doesn’t matter what sketch is open during this time).

The flash process only takes a few seconds (for me). When the bootloader has been flashed successfully, you will get a message that looks something like this:

 Using Port : COM16 Using Programmer : stk500v1 Overriding Baud Rate : 19200 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :[...] Programmer Type : STK500 Description : Atmel STK500 Version 1.x firmware Hardware Version: 2 Firmware Version: 1.18 Topcard : Unknown Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.02savrdude: Device signature = 0x1e950f (probably m328p)avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option.avrdude: erasing chipavrdude: reading input file "C:UsersuserAppDataLocalArduino15packagesarduinohardwareavr1.8.2/bootloaders/optiboot/optiboot_atmega328.hex"avrdude: writing flash (32768 bytes):Writing | ################################################## | 100% 0.00savrdude: 32768 bytes of flash writtenavrdude: verifying flash memory against C:UsersuserAppDataLocalArduino15packagesarduinohardwareavr1.8.2/bootloaders/optiboot/optiboot_atmega328.hex:avrdude: load data flash data from input file C:UsersuserAppDataLocalArduino15packagesarduinohardwareavr1.8.2/bootloaders/optiboot/optiboot_atmega328.hex:avrdude: input file C:UsersuserAppDataLocalArduino15packagesarduinohardwareavr1.8.2/bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytesavrdude: reading on-chip flash data:Reading | ################################################## | 100% 0.00savrdude: verifying ...avrdude: 32768 bytes of flash verifiedavrdude: reading input file "0x0F"avrdude: writing lock (1 bytes):Writing | ################################################## | 100% 0.02savrdude: 1 bytes of lock writtenavrdude: verifying lock memory against 0x0F:avrdude: load data lock data from input file 0x0F:avrdude: input file 0x0F contains 1 bytesavrdude: reading on-chip lock data:Reading | ################################################## | 100% 0.01savrdude: verifying ...avrdude: 1 bytes of lock verifiedavrdude done. Thank you.

cover image: by Nizzah Khusnunnisa on Unsplash, modified with Canva

FAQs

How to update bootloader in Arduino? ›

To do so open the board manager in the menu under Tools >Board >Boards Manager...
  1. Open the Boards Manager from the Tools menu.
  2. A search for "portenta" reveals the core that needs to be updated to get the latest bootloader.
  3. Finding the bootloader updater sketch.
  4. The bootloader updater sketch.

How to update Arduino Nano firmware? ›

Connect the board to your computer and make sure the Serial Monitor is not open. Open the Device tab in Arduino IoT Cloud.
...
Update the firmware
  1. Open the Device tab.
  2. Click the row with your device.
  3. Click the firmware UPDATE button.
Sep 20, 2022

How to flash a bootloader? ›

In order to flash the SD bootloader to the chip, you must first enter the Serial Bootloader mode. This mode allows you to write new code to the FLASH memory via UART0.
...
Entering bootloader mode
  1. Press the RESET button.
  2. Press the BOOTLOADER (ISP) button.
  3. Release the RESET button.
  4. Release the BOOTLOADER (ISP) button.
Jul 17, 2022

Does Arduino Nano have flash memory? ›

Basically, there are three types of Memory on Arduino Boards like UNO, Mega 2560 or Nano. They are: Flash. RAM.
...
Flash.
Arduino BoardMicrocontrollerSize of Flash Memory
Arduino NanoATmega328P32 KB
Arduino Mega 2560ATmega 2560256 KB
Arduino MicroATmega32U432 KB
Arduino LeonardoATmega32U432 KB
1 more row
Jan 30, 2021

How do I download Arduino bootloader? ›

The easy way to upload the bootloader involves using the Arduino IDE. Open your IDE select the board you want to program. Then select the programmer (if you are using the Arduino as ISP you will also need to select the COM port that the Arduino as ISP is connected to). Then select BurnBootloader.

What is the difference between old and new Arduino Nano bootloader? ›

OLD Bootloader uploads Sketches at only 57600 bps baud rate, while the new OptiBoot accepts 115200 bps making transferring code to your Arduino twice as fast. This is a huge help when it comes to more complex coding that will often need multiple changes to fix bugs where you are uploading updated sketch's frequently.

What is the difference between old bootloader and new bootloader in Arduino? ›

Old bootloader runs on optiboot, whereas the new bootloader runs on ATmegaBOOT. The two significant changes from the old bootloader to the new offers the ability to prevent endless reset loop after a watchdog reset and the upload baud rate has been reduced to 57600 instead of 115200.

How do I manually update the firmware for my device? ›

Get the latest Android updates available for you
  1. Open your phone's Settings app.
  2. Near the bottom, tap System. System update.
  3. You'll see your update status. Follow any steps on the screen.

How do I manually update firmware? ›

Go to Control Panel > System > Firmware Update > Firmware Update. Click Browse and then select the extracted firmware image file. Click Update System. Select a restart option.

Can we reprogram Arduino Nano? ›

Restoring it requires burning (also called flashing) a new bootloader. The method and required equipment will vary depending on the board, start by checking these resources: Burn the bootloader on UNO, Mega, and classic Nano using another Arduino. Burning sketches to the Arduino board with an external programmer.

How do I know if my Arduino Nano has a bootloader? ›

In the IDE preferences check the option show verbose output on upload. Upload a sketch, and when you click the upload button in the IDE, also press the reset button of the Nano. Release the reset button when the IDE changes from Compiling to Uploading. avrdude done.

What is the default bootloader of the Arduino? ›

5. What is the default bootloader of the Arduino UNO? Explanation: The optiboot bootloader will take 512 bytes, leaving 32256 bytes for application code. Due to its small size larger up-loadable sketch size is achieved.

What is a Flash bootloader? ›

The Flash Bootloader module is the first software module that gets activated during the booting of the system (after the power supply of the device is switched on). The control is transferred to the Flash Bootloader, which checks for the updated version of the firmware.

Can bootloader be hacked? ›

Chromebooks use custom bootloaders that can be modified or overwritten by removing a Write-protect screw. In 2013, the bootloader of the Chromecast was hacked using an exploit. In 2021, it was hacked again for newer versions.

What are the two types of bootloader? ›

For Linux, the two most common boot loaders are known as LILO (LInux LOader) and LOADLIN (LOAD LINux). An alternative boot loader, called GRUB (GRand Unified Bootloader), is used with Red Hat Linux. LILO is the most popular boot loader among computer users that employ Linux as the main, or only, operating system.

How do I install GRUB bootloader on a flash drive? ›

Steps:
  1. Download the grub .txz package, here: ...
  2. Right click on the . ...
  3. Insert the second USB drive, and mount it. ...
  4. Create a new directory to hold grub on the target drive: ...
  5. Copy all of the files from /usr/lib/grub/i386-pc to /mnt/sdc1/boot/grub.
  6. In your terminal, type 'grub' and hit enter.

How do I import a hex file into Arduino Nano? ›

In the Arduino software, go to the File menu then Preferences. Select the port and type of card to which you want to upload the program. When you press Compile or Upload, the Arduino IDE creates a build file in the folder AppData\Local\Temp\ in which the HEX file is located.

What does it mean to burn bootloader Arduino? ›

The "Burn Bootloader" commands in the Arduino environment use an open-source tool, avrdude. There are four steps: unlocking the bootloader section of the chip, setting the fuses on the chip, uploading the bootloader code to the chip, and locking the bootloader section of the chip.

How to flash code to Arduino? ›

Learn the basics of uploading a sketch in Arduino IDE: Open Arduino IDE.
...
  1. Open Arduino IDE. If you haven't done so already, download Arduino IDE from the software page. ...
  2. Connect the board to your computer. Next, connect to board to your computer with a USB cable. ...
  3. Install board package. ...
  4. Select board and port. ...
  5. Upload a sketch.
Dec 5, 2022

How do I program my Arduino Nano using USB to TTL? ›

For uploading code:
  1. First make the following connections with the USB to Serial/TTL Adapter. ...
  2. Open Arduino IDE >> File >> Examples >> Basics >> Blink.
  3. Press the pushbutton >> Hit upload.
  4. Keep on pressing if it says “Compiling sketch…”
  5. Release the button as soon as it says “Uploading…”
  6. Done!

References

Top Articles
Latest Posts
Article information

Author: Allyn Kozey

Last Updated: 01/08/2023

Views: 5939

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.