Arduino Uno / Optiboot Upload Performance

Uno Bootloader (Optiboot)

Can upload performance with the Arduino Uno / Optiboot be improved?  This document sets out to answer that question.

An Arduino Uno R2 with Optiboot 4.4 installed was used for the performance tests.  avrdude 5.11 was used to upload, verify, and time the tests.  Values are the programming rate (upload, write, read, verify) in bytes per second.

Image Size Test

An 8,192 byte image (8 KiB) and a 32,256 byte image (31.5 KiB) image were used for the first test.  The goal is to determine if there is a significant difference in programming times from the image size.  On average the smaller image is programmed in 3471.2 bytes per second and the larger image is programmed in 3430.3.  Unfortunately, the time measurement resolution prevents performing a statistic significance test.  This test gets labeled too close to call.

Baud Rate Test

Baud rates of 115,200 (normal Optiboot baud rate), 250K, 500K, and 1M were used for the second test.  The goal is to determine if there is a significant difference in programming performance from the baud rate.

Optiboot overlaps writing with serial I/O.  In theory, once the baud rate is high enough to keep the writing circuitry busy, further baud rate increases will have no effect.  Reading (verify) is not overlapped with serial I/O.  In theory, reading performance will always increase as the baud rate increases.  However, there is a limit to the amount of data a 16 MHz eight-bit processor can send per second.  At some point the processor becomes “maxed-out” and further baud rate increases have no effect.

At 115,200 baud, the programming rate is 3430.3.  At 250K baud, the programming rate is 4394.6.  The difference is a whopping 28.1%.  While the biggest difference is in reading (33.2%) writing is improved by 24.4%.  This indicates that, at 115,200 baud, the writing circuitry is idle for a significant amount of time while the next chunk of data is being sent.

At 500K baud, the programming rate is 5211.0.  The difference compared to 250K baud is still huge at 18.6%.  However, writing is improved by a mere 2.7%.  Reading is improved by 50.5%.  This indicates that the writing circuitry is almost saturated at 250K baud.

At 1M baud, the programming rate is 5208.2.  Essentially the rates are identical to 500K baud for both writing and reading.  This indicates that, at 500K baud, the writing circuitry is saturated and the processor is maxed-out when reading.

Conclusion

If verify is performed during programming, using a 500K baud bootloader is highly recommended.  Upload performance is significantly improved and, with the verify pass, any serial communication problems at the higher baud rate are detected.

If verify is not performed, using a 250K baud bootloader is highly recommended.  The writing rate is significantly improved and serial communication problems at 250K baud are highly unlikely.

High Baud Rate Variations

The high baud rate variations of Optiboot 4.4 are available here: High baud rate variations of Optiboot 4.4.

To install the high baud rate variations…

  • Ensure the Arduino IDE is not running
  • Download the 7-Zip archive using the link above
  • Extract the three files to the following directory…
  • {Arduino Installation Root}\hardware\arduino\bootloaders\optiboot\
  • Open the boards.txt file located in the following directory…
  • {Arduino Installation Root}\hardware\arduino\
  • Confirm that the section for the Arduino Uno is identical to this…
uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard
  • Add the following section…
uno_uf.name=Arduino Uno / Upload Fast
uno_uf.upload.protocol=arduino
uno_uf.upload.maximum_size=32256
uno_uf.upload.speed=250000
uno_uf.bootloader.low_fuses=0xff
uno_uf.bootloader.high_fuses=0xde
uno_uf.bootloader.extended_fuses=0x05
uno_uf.bootloader.path=optiboot
uno_uf.bootloader.file=optiboot_atmega328_250000.hex
uno_uf.bootloader.unlock_bits=0x3F
uno_uf.bootloader.lock_bits=0x0F
uno_uf.build.mcu=atmega328p
uno_uf.build.f_cpu=16000000L
uno_uf.build.core=arduino
uno_uf.build.variant=standard
  • Change the two highlighted values to the baud rate you plan to use: 250000, 500000, or 1000000
  • Save and close the boards.txt file
  • Using your favourite ISP programmer, install the new bootloader.  Don’t forget to…
    • Ensure the Arduino Uno / Upload Fast board is selected (Tools / Board)
    • If appropriate, ensure the Serial Port of your programmer is selected (Tools / Serial Port)
    • Ensure the programmer is selected (Tools / Programmer)
    • After installing the bootloader, change the Serial Port to the serial port of your Arduino Uno

Leave a Reply