Programming

In addition to using the pre-programmed bootloader with AVR Studio, the ATmega169 on the AVR Butterfly can be programmed using SPI, High-voltage Parallel Programming and the JTAG interface.

In-System Programming

Figure 1. In-System Programming

To program the ATmega169 using ISP Programming mode, connect a 6-wire cable between the ISP6PIN connector on the STK500 board and J403 the ISP connector on the AVR Butterfly as shown in the figure above This device can be programmed using the Serial Programming mode in the AVR Studio4 STK500 software. Instead of soldering in a ISP-header, one can make contact just by pressing the header to the footprint. Make sure that pin 1 on the STK500 match with pin 1 on the AVR Butterfly. See AVRBUTTERFLY.html for the pinout of the ISP Connector.

Figure 2. ISP Connector, J403

Note: Do not use the AVRISP for In-System Programming, unless if the kit is powered from an external power source

High-voltage Parallel Programming

It is possible to program the ATmega169 through the High-voltage Parallel Programming interface. However this requires to move two resistors on the PCB. High-voltage Parallel Programming is only meant to be used in the worst case scenario, where both SPI and the JTAG interface are disabled.

To make the parallel programming work, R203 must be placed where the R204 should be, and R404 must be placed where the R403 should be according to the figure below. See the Assembly Drawing in the BOM and Schematics.

Figure 3. 0-Ohm Resistors

Connect RESET, BSEL2 and XTAL1 from the STK500 to respectively pin 6, pin 8 and pin 10 on the JTAG (J402) connector on the AVR Butterfly. See figure below. The JTAG connector must be mounted on the back side of the AVR Butterfly.

Figure 4. Reset, BSEL2 and XTAL1 cables

Connect PROG DATA and PROG CTRL from the STK500 to respectively PORTB and PORTD on the AVR Butterfly. Make sure that pin 1 on the STK500 connects to pin 1 on the AVR Butterfly.

Figure 5. PORTB and PORTD

See the Schematic and the Assembly Drawing in the BOM and Schematics for further details.

The device can now be programmed using the High-voltage Programming mode in Atmel Studio STK500 software.

During programming there will be some noise from the piezo element, and some flickering on the LCD, this because PORTB and PORTD are connected to theses modules.

Figure below shows the pinout for the I/O port headers PORT B and PORT D.

Figure 6. PortB and PortD pinout

Note: When the AVR Butterfly is configured in High-voltage Parallel Programming mode, the JTAG interface will not work, neither will the external crystal, causing the pre-programmed application that comes with the AVR Butterfly to not operate correctly