6.3. Connecting to a serial bootloader

The Pololu USB AVR Programmer v2 (top) connected to an Adafruit Pro Trinket for programming.

The six pins on the serial header (GND, A, VCC, TX, RX, and B) are arranged to be similar to the pinout of commonly-available FTDI USB-to-serial cables and breakout boards. In the default configuration, pin B is used as the DTR output (and pin A is an unused input). By default, the programmer’s regulator mode is Auto, which means the programmer will operate at 3.3 V when it starts up, but it will change to 5 V if you plug it into a 5 V device.

In this default configuration, the programmer can often be used in place of an FTDI cable: you can plug it directly into various Arduino-compatible boards and use it to upload sketches via a serial bootloader. The rest of this section explains the details of how this works.

When you click the “Upload” button in the Arduino IDE to program an Arduino such as the Arduino Uno, the IDE will run AVRDUDE with a command like this:

avrdude -patmega328p -carduino -PCOM6 -b115200 -D -Uflash:w:Sketch.ino.hex:i 

The -carduino option specifies that AVRDUDE is going to talk to an Arduino-style serial bootloader. This means that after AVRDUDE opens up the specified serial port (COM6 in this case), it will set the DTR and RTS signals on that port to 0, and then set them to 1. Typical serial terminal programs will also set DTR and RTS to 1. When the signals change from 0 to 1, the programmer’s DTR line will change from a high voltage (VDD) to low (GND). The board with the AVR on it will usually have a simple circuit with a capacitor so that when DTR changes from high to low, the reset line of the board’s AVR sees a low pulse, making it reset.. This feature is called “auto-reset”. Resetting the AVR like this causes its bootloader to run, and AVRDUDE will attempt to talk to the bootloader using the programmer’s RX and TX lines in order to upload the specified HEX file.

Using the programmer’s configuration software, you can change pin A or B to be the DTR reset signal. This is an output that is designed specifically for the auto-reset feature. Whenever DTR changes from 0 to 1, the programmer will drive DTR reset low for 1 ms. You can plug the DTR reset signal directly into an AVR microcontroller’s RST line without needing to use a capacitor.

Related Products

Pololu USB AVR Programmer v2
Pololu USB AVR Programmer v2.1
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors