<?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>Evolving NG UAVP &#187; AVR</title>
	<atom:link href="http://uavp.agner.ch/category/avr/feed/" rel="self" type="application/rss+xml" />
	<link>http://uavp.agner.ch</link>
	<description>falstaff&#039;s blog about building and developing multicopters</description>
	<lastBuildDate>Wed, 06 Oct 2010 21:49:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Bus Pirate</title>
		<link>http://uavp.agner.ch/2010/05/bus-pirate/</link>
		<comments>http://uavp.agner.ch/2010/05/bus-pirate/#comments</comments>
		<pubDate>Sun, 23 May 2010 00:34:24 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[AVR]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[JTAG]]></category>

		<guid isPermaLink="false">http://uavp.agner.ch/?p=172</guid>
		<description><![CDATA[As I wrote yesterday I bougth the Bus Pirate from Seeedstudio and a nice case. Another team member found this nice tool. It can be used to prototype and test electronic deviecs with buses such as UART, SPI or I2C. As I saw the ability to work as an AVR programmer and even a JTAG [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_173" class="wp-caption alignright" style="width: 310px"><a href="http://uavp.agner.ch/wp-content/uploads/2010/05/bus-pirate-small.jpg"><img class="size-medium wp-image-173" title="Bus Pirate" src="http://uavp.agner.ch/wp-content/uploads/2010/05/bus-pirate-small-300x203.jpg" alt="Bus Pirate" width="300" height="203" /></a><p class="wp-caption-text">Bus Pirate</p></div>
<p>As I wrote yesterday I bougth the <a href="http://dangerousprototypes.com/bus-pirate-manual/">Bus Pirate</a> from <a href="http://www.seeedstudio.com/depot/bus-pirate-v3-assembled-p-609.html">Seeedstudio</a> and a <a href="https://www.synthetos.com/">nice case</a>. Another team member found this nice tool. It can be used to prototype and test electronic deviecs with buses such as UART, SPI or I2C.  As I saw the ability to work as an AVR programmer and even a JTAG adapter I was persuaded of it as well. It looks like a perfect devleoper device for the NG UAVP.<br />
With delivery I paid about 55$ for both parts. The case from US arrived way faster then the Pirate itself from China, but finally both made their way to Switzerland! I needed to alter the case with a nail file a little bit to make sure the USB connector has enought space. Built into its case it looks very nice!<br />
The firmware on the delivered device was not that up to date:</p>
<pre>HiZ&gt;I
Bus Pirate v3 (Seeed Studio)

http://dangerousprototypes.com

Firmware v2.4-Seeed
DEVID:0x0447 REVID:0x3043 (B5)
</pre>
<p><span id="more-172"></span><br />
First I had to upgrade to <a href="http://dangerousprototypes.com/2010/01/18/how-to-bus-pirate-bootloader-v4-upgrade/">V4 Bootloader</a>. I connected the PGD and PGC pins of the ICSP header to trigger the bootloader. Then I changed bitrateindex to 8 (for 115200):</p>
<pre>vi P24qp.ini
</pre>
<pre>bitrateindex=8
</pre>
<p>Afterwards I could do the firmwareupgrade (just ignore the verification errors in the output, its a bug in v2 bootloader):</p>
<pre>$ unzip v2tov41-bootloader-update-va3.zip
$ cd upgrader
$ sudo python P24qp.py --serial=/dev/ttyUSB1 -v --auto=BPv3-v2blupdaterVa3-v4.1.hex
....
Writing 256 bytes to address 0x0000AB80
Reading 256 bytes from address 0x0000AB80
Write operation complete.
Verified Okay.
Verification complete, switching to user mode
</pre>
<p>Now I removed the jumper and restartet the Bus Pirate. Pressing enter produced this output:</p>
<pre>Upgrade cancelled.

Universal DS30 Loader installer v0.3 (C)hris 2010

Released under Creative Commons null license.
Found bootloader v unknown (probably v2)
Will install bootloader v4.1

Type 'Yes' to program the new bootloader.
Disconnect power if unsure (no harm done).
</pre>
<p>&#8220;Yes&#8221; started the upgrading</p>
<pre>Erasing 0xA400... done
Erasing 0xA800... done
Writing row 0 1 2 3 4 5 6 7 done
Erasing 0x0000... done
Writing row 0... done

Success!
Upload new firmware with the ds30 Loader app to complete the upgrade.
</pre>
<p>When the update is complete, the MODE LED will blink and the upgrader will prompt you to upload a v4+ firmware. I connected the PGD and PGC pins of the ICSP header to trigger the bootloader once again and restarted the Bus Pirate. I then uploaded the <a href="http://dangerousprototypes.com/2010/03/05/bus-pirate-firmware-v4-2-released/">v4.2 firmware</a> directly (you can&#8217;t install the v4.2 bootloader since its only a version for programm with PIC directly):</p>
<pre>$ unzip BusPirate.firmware.v4.2.zip
$ sudo ./pirate-loader_lnx --dev=/dev/ttyUSB1 --hex=BPv3\&amp;v2go/BPv3-Firmware-v4.2.hex
</pre>
<p>Removed the jumper again and the Bus Pirate has a shiny new software version on it:</p>
<pre>HiZ&gt;I
Bus Pirate v3
Firmware v4.2 Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)

http://dangerousprototypes.com
</pre>
<h2>AVR programmer (STK500v2)</h2>
<p>One of the features I needed most was the AVR programmer. For that purpose you have to flash a special firmware:</p>
<pre>$ sudo ./pirate-loader_lnx --dev=/dev/ttyUSB1 --hex=BPv3\&#038;v2go/BPv3-STK500v2-v0b.hex
</pre>
<p>Afterwards you can use it like an STK500v2:</p>
<pre>$ avrdude -p m328p -c stk500v2 -P /dev/ttyUSB1 -v -V -U flash:w:sb-ctrl.hex
</pre>
<p>Just a small performance comparission showed positive results. I wrote an Intel hex with 30178 bytes to an Atmel ATMEGA328P. These are the flash times:</p>
<table border="0">
<tbody>
<tr>
<td width="100px">Bus Pirate</td>
<td>STK500v2</td>
</tr>
<tr>
<td>10.75s</td>
<td>42.55s</td>
</tr>
</tbody>
</table>
<p>Note: These are both out of the box configuration, with correct STK500v2 configuration you can probably gain more performance&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://uavp.agner.ch/2010/05/bus-pirate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

