<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dana Harding &#187; AVR ISP</title>
	<atom:link href="http://blog.oneharding.com/index.php/tag/avr-isp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.oneharding.com</link>
	<description></description>
	<lastBuildDate>Sun, 29 Apr 2018 17:25:34 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Programming Arduino Pro Mini with Bus Pirate</title>
		<link>http://blog.oneharding.com/index.php/programming-arduino-pro-mini-with-bus-pirate/</link>
		<comments>http://blog.oneharding.com/index.php/programming-arduino-pro-mini-with-bus-pirate/#comments</comments>
		<pubDate>Mon, 05 Jan 2015 02:01:51 +0000</pubDate>
		<dc:creator><![CDATA[Dana]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Pro Mini 328]]></category>
		<category><![CDATA[AVR ISP]]></category>
		<category><![CDATA[Bus Pirate]]></category>

		<guid isPermaLink="false">http://blog.oneharding.com/?p=211</guid>
		<description><![CDATA[Program an Arduino Pro Mini 328 [sparkfun] board using a Bus Pirate. I tried setting up the Bus Pirate as a transparent bridge for UART to use the Arduino boot loader. I got as far as manually sending 0x30 0x20, and receiving a 0x10 0x14 &#8211; establishing communication over UART&#8230; But couldn&#8217;t get the Arduino [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>Program an <a title="Arduino Pro Mini 328 - 5V/16MHz" href="https://www.sparkfun.com/products/11113">Arduino Pro Mini 328</a> [sparkfun] board using a <a title="Bus Pirate" href="https://www.sparkfun.com/products/9544">Bus Pirate</a>.</strong></p>
<div id="attachment_218" style="width: 635px" class="wp-caption aligncenter"><a href="http://blog.oneharding.com/wp-content/uploads/2015/01/IMG_1052.jpg"><img class="size-large wp-image-218" src="http://blog.oneharding.com/wp-content/uploads/2015/01/IMG_1052-1024x768.jpg" alt="Bus Pirate programming Arduino Pro Mini 328" width="625" height="468" /></a><p class="wp-caption-text">Bus Pirate programming Arduino Pro Mini 328</p></div>
<p>I tried setting up the Bus Pirate as a transparent bridge for UART to use the Arduino boot loader. I got as far as manually sending 0x30 0x20, and receiving a 0x10 0x14 &#8211; establishing communication over UART&#8230; But couldn&#8217;t get the Arduino IDE to actually upload a program to it.</p>
<p>It turns out &#8211; version depending &#8211; that avrdude can use the buspirate as an SPI programmer.<br />
<a href="http://dangerousprototypes.com/docs/Bus_Pirate_AVR_Programming">http://dangerousprototypes.com/docs/Bus_Pirate_AVR_Programming</a></p>
<h2></h2>
<p><span id="more-211"></span></p>
<h2>Wiring for SPI</h2>
<p>A bare minimum 4 connections need to be made for the communication:  MOSI, MISO, SCLK, GND.    The Arduino also needs VCC and the reset pin needs some manipulation.  I made 6 connections.</p>
<p>Pinout for my Bus Pirate: <a href="http://blog.oneharding.com/wp-content/uploads/2015/01/Bp-pin-cable-color.png"><img class="aligncenter size-full wp-image-214" src="http://blog.oneharding.com/wp-content/uploads/2015/01/Bp-pin-cable-color.png" alt="Bp-pin-cable-color" width="796" height="297" /></a><a href="http://dangerousprototypes.com/docs/Hardware_overview">http://dangerousprototypes.com/docs/Hardware_overview</a></p>
<p>&nbsp;</p>
<p>Schematic for Arduino-Pro-Mini 328 showing connections &#8211; note the locations of MSIO MOSI and SCK.  This schematic shows the actual ATMega328P pin numbers, but not the pin numbers labeled on the breakout (and used in the Arduino IDE)<br />
<a href="http://blog.oneharding.com/wp-content/uploads/2015/01/Arduino-Pro-Mini-v14.jpg"><img class="aligncenter size-full wp-image-215" src="http://blog.oneharding.com/wp-content/uploads/2015/01/Arduino-Pro-Mini-v14.jpg" alt="Arduino-Pro-Mini-v14" width="602" height="450" /></a><br />
<a href="https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.pdf">https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.pdf</a><br />
<a href="https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.zip">https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.zip</a></p>
<p>6 Connections Made:</p>
<p><a href="http://blog.oneharding.com/wp-content/uploads/2015/01/IMG_1049-connection-markup.jpg"><img class="aligncenter size-full wp-image-216" src="http://blog.oneharding.com/wp-content/uploads/2015/01/IMG_1049-connection-markup.jpg" alt="IMG_1049 connection markup" width="854" height="647" /></a></p>
<table>
<tbody>
<tr>
<td><b>Bus Pirate</b></td>
<td><b>Arduino Pro Mini 328</b></td>
</tr>
<tr>
<td>+5V (gray)</td>
<td>VCC</td>
</tr>
<tr>
<td>GND (black)</td>
<td>GND</td>
</tr>
<tr>
<td>MOSI (orange)</td>
<td>Pin 11</td>
</tr>
<tr>
<td>MISO (brown)</td>
<td>Pin 12</td>
</tr>
<tr>
<td>CLOCK (yellow)</td>
<td>Pin 13</td>
</tr>
<tr>
<td>CS (red)</td>
<td>RST</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h2>Test Bus Pirate connection</h2>
<p>$ avrdude -c buspirate</p>
<pre><code>avrdude: No AVR part has been specified, use "-p Part"

Valid parts are:
  t10  = ATtiny10        [/etc/avrdude.conf:16881]
  t9   = ATtiny9         [/etc/avrdude.conf:16837]
  t5   = ATtiny5         [/etc/avrdude.conf:16793]
  t4   = ATtiny4         [/etc/avrdude.conf:16749]
  ucr2 = 32UC3A0512      [/etc/avrdude.conf:
...
</code></pre>
<p>read the list, my part is m328p<br />
$ avrdude -c buspirate -p m328p</p>
<pre><code>avrdude: ser_open(): can't set attributes for device "/dev/ttyS0": Inappropriate ioctl for device

avrdude done.  Thank you.
</code></pre>
<p>Third try is a charm.<br />
$ avrdude -c buspirate -p m328p -P /dev/ttyUSB0</p>
<pre><code>Detecting BusPirate...
**  
**  Bus Pirate v3a
**  Firmware v5.10 (r559)  Bootloader v4.4
**  DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)
**  http://dangerousprototypes.com
**
BusPirate: using BINARY mode
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
</code></pre>
<p>Success!</p>
<p>I initially had the CS wire connected to GRN &#8211; which wasn&#8217;t pulling the reset pin down. Avrdude was giving an error:</p>
<pre><code>avrdude: initialization failed, rc=-2
         Double check connections and try again, or use -F to override
         this check.
</code></pre>
<p>Connecting CS to RST fixed this. Alternatively, you can hold the reset button down during the execution of the commands.</p>
<h2></h2>
<h2>Make it work with the Arduino IDE</h2>
<p>Turned out to be deceptively simple.</p>
<p>Thanks <a href="http://www.adafruit.com/blog/2011/05/09/using-bus-pirate-with-arduino-ide/">http://www.adafruit.com/blog/2011/05/09/using-bus-pirate-with-arduino-ide/</a></p>
<p>(<a href="https://taylanayken.wordpress.com/2011/05/04/using-bus-pirate-with-arduino-ide/">https://taylanayken.wordpress.com/2011/05/04/using-bus-pirate-with-arduino-ide/</a>)</p>
<p><code>$ cd arduino-ide-location<br />
$ vi hardware/arduino/programmers.txt</code></p>
<p>Add three lines:</p>
<pre><code>
buspirate.name=The Bus Pirate
buspirate.communication=serial
buspirate.protocol=buspirate</code></pre>
<p><a href="http://blog.oneharding.com/wp-content/uploads/2015/01/Screenshot-040115-065345-PM.png"><img class="aligncenter size-full wp-image-217" src="http://blog.oneharding.com/wp-content/uploads/2015/01/Screenshot-040115-065345-PM.png" alt="Screenshot - 040115 - 06:53:45 PM" width="500" height="600" /></a></p>
<p>Load your project, select the Bus Pirate as the programmer, select the right board, serial port. Instead of &#8220;Upload&#8221;, shift-click it for &#8220;Upload using Programmer&#8221; or File-&gt;Upload using Programmer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.oneharding.com/index.php/programming-arduino-pro-mini-with-bus-pirate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
