<?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>Embedded Development on OSX.</title>
	<atom:link href="http://www.osx-avr.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.osx-avr.org</link>
	<description>I am pretty certain that Apple Hates Developers. I am almost positive they despise embedded developers.</description>
	<lastBuildDate>Wed, 14 Jul 2010 08:32:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>98-all-your-atmel-belong-to-us</title>
		<link>http://www.osx-avr.org/avr-development/98-all-your-atmel-belong-to-us/</link>
		<comments>http://www.osx-avr.org/avr-development/98-all-your-atmel-belong-to-us/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 08:32:08 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Avr Development]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=652</guid>
		<description><![CDATA[Foobarred is Normal Recently I started using my linux laptop as my primary avr-usb development environment. When I upgraded the laptop to the current Ubuntu-LTS release (10.4 aka Lucid lynx) a bunch of stuff was broken including all of the wonderful udev rules provided by my linux savvy friends at dorkbotpdx. I mean jeesh even [...]]]></description>
			<content:encoded><![CDATA[<h2>Foobarred is Normal</h2>
<p>Recently I started using my linux laptop as my primary avr-usb development environment. When I upgraded the laptop to the current Ubuntu-LTS release (10.4 aka Lucid lynx) a bunch of stuff was broken including all of the wonderful udev rules provided by my linux savvy friends at dorkbotpdx.</p>
<p>I mean jeesh even lsusb was broken.</p>
<pre>$ lsusb -vd "03eb:"|grep iM
cannot read device status, Operation not permitted (1)
iManufacturer           1</pre>
<p>When I started looking at what changed and how to adjust, the web dead ended to a lot of threads like the one at <a href="http://ubuntuforums.org/showthread.php?t=1360412" target="_blank">http://ubuntuforums.org/showthread.php?t=1360412</a> ; where two people declared that having to escalate privileges to root in order to talk to a user device was &#8220;normal&#8221;. Even when the developer said it wasn&#8217;t normal the ubuntu folk redeclared it normal (apparently after Bush you just have to repeat something blatantly stupid for it to be true). As an administrator the <strong><em>last</em></strong> thing you want is everything and its dog requiring root privileges.</p>
<p>Hanging around the #ubuntu channel was a lot like having people repeat the searches on the web that provided me with the same dead ends that I joined the channel trying to resolve.</p>
<h2>Cherchez la femme (look at the squeeze)</h2>
<p>This was getting stupid. All I wanted to do was to have devices that I could plug in and program and then communicate with them using ruby or perl or some other haphazzardly thrown together scripts without having to be root. Then I realized once again that ubuntu is really focused on making the users life easier and that this leads to a lot of non technical help. So I asked my friends what the nick name was for the Debian release that was the basis for the Ubuntu release nick named &#8220;Lucid&#8221; and then re did all of my dead ended web queries replacing &#8220;Ubuntu Lucid&#8221; with &#8220;Debian Squeeze&#8221;.</p>
<p>The results were heavy on the technical detail and light on social skills.</p>
<p>More importantly I quickly found the solution that I needed in the middle of <a href="http://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver?a=blob_plain&amp;f=README&amp;hb=HEAD" target="_blank">this link<em> (http://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver?a=blob_plain&amp;f=README&amp;hb=HEAD)</em></a> what I was missing was the difference between the new and the old udev rules.</p>
<p style="padding-left: 30px"><em>&#8220;If you are running a newer version of udev (as in Debian Squeeze and<br />
Ubuntu 9.10), you need to adapt the rules-file to the new udev-version:<br />
sed -i -e &#8216;s/TEMPNODE/tempnode/&#8217; -e &#8216;s/SYSFS/ATTRS/g&#8217; -e &#8216;s/BUS/SUBSYSTEMS/&#8217; \<br />
/etc/udev/rules.d/xusbdfwu.rules&#8221;</em></p>
<p>One line of sed was all I needed and it had taken me a week of asking about <em>lucid</em> when i should have been asking about <em>squeeze</em>. With this I also was able to find the changes to the lay out of the /dev and /proc trees and the new tools to monitor udev and diagnose issues.</p>
<h2>All-Your-Atmel-Belong to Us</h2>
<p>I really just wanted to change the permissions so I could use my devices. Adding the following udev rule to your system will do just that.  You will also need to restart the udev service. Both of these will require you to be root.</p>
<pre># cat &gt;/etc/udev/rules.d/98-all-your-atmel-belong-to-us.rules&lt;&lt;EOF
#------------------------/etc/udev/rules.d/98-all-your-atmel-belong-to-us.rules
#
# Make atmel devices (dfu, LUFA, obdev) accessible in userland
# 
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", MODE="0666"
EOF
# service udev restart</pre>
<p>To actually own all my atmel I could have also added &#8216; ,USER=&#8221;don&#8221; &#8216; after the mode part but I just wanted to talk my Atmel  usb-avr devices and the open source firmware I was developing. And the above rule made things &#8220;just work&#8221;.</p>
<pre>$ lsusb -vd "03eb:"|grep iM
iManufacturer           1 mycompany.com
$</pre>
<p>This rule fixed all of my LUFA based devices including the my open source arduino programmer as well as the dfu programmer.used to code them. Hopefully it will be a while before I have to go through this again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/98-all-your-atmel-belong-to-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>There&#8217;s trunk and then there&#8217;s whatever-ax-was-using</title>
		<link>http://www.osx-avr.org/avr-development/theres-trunk-and-then-theres-whatever-ax-was-using/</link>
		<comments>http://www.osx-avr.org/avr-development/theres-trunk-and-then-theres-whatever-ax-was-using/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 21:33:14 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Avr Development]]></category>
		<category><![CDATA[Mac Development]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=648</guid>
		<description><![CDATA[feurig: ax have you gotten anything to work with deans post feburary lufa? [1:29pm] ax: post feb. hmm, i&#8217;d have to look into my project files to remember which version i was usting [1:29pm] ax: just a sec [1:29pm] feurig: I was pulling my hair out with the may release and then I went back [...]]]></description>
			<content:encoded><![CDATA[<p>feurig: ax have you gotten anything to work with deans post feburary lufa?<br />
[1:29pm] ax: post feb. hmm, i&#8217;d have to look into my project files to remember which version i was usting<br />
[1:29pm] ax: just a sec<br />
[1:29pm] feurig: I was pulling my hair out with the may release and then I went back to the standard &#8220;what ever ax was using&#8221; and things started working<br />
[1:30pm] feurig: you used the feb19 release on the midimonster stuff<br />
[1:30pm] feurig: where is that (explicitive deleted) tourist????<br />
[1:34pm] ax: yeah, /lufa_100219/<br />
[1:35pm] ax: i like this &#8216;whatever ax was using&#8217; standard<br />
[1:35pm] ax:<br />
[1:48pm] bzztbomb: That should be a source control tag</p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/theres-trunk-and-then-theres-whatever-ax-was-using/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I hate DarwinPorts/MacPorts.</title>
		<link>http://www.osx-avr.org/sortme/why-i-hate-darwinportsmacports/</link>
		<comments>http://www.osx-avr.org/sortme/why-i-hate-darwinportsmacports/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 08:45:28 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Mac Development]]></category>
		<category><![CDATA[Sort Me]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=639</guid>
		<description><![CDATA[Because they aren&#8217;t bsd ports. They force you to carry redundant dependencies. They do not allow you to fetch and compile the source files in a transparent way. They do not give you clean access to the patches they use to make things work. They haven&#8217;t had a current version of avr-gcc in over 4 [...]]]></description>
			<content:encoded><![CDATA[<h2>Because they aren&#8217;t bsd ports.</h2>
<ul>
<li>They force you to carry redundant dependencies.</li>
<li>They do not allow you to fetch and compile the source files in a transparent way.</li>
<li>They do not give you clean access to the patches they use to make things work.</li>
<li>They haven&#8217;t had a current version of avr-gcc in over 4 years.</li>
<li>They just dont get it.</li>
</ul>
<p>Today, I am working on a cross platform USB device which I hope to interface with ruby, python, and perl using libusb. The ruby bindings for libusb are for 1.0.xx which actually almost works on OSX nowadays. A quick sampling of using ruby-usb on osx, like most things embedded in apple land, is a trip more or less to hell. (see:<a href="http://www.jedi.be/blog/2009/11/11/ruby-usb-libusb/"> http://www.jedi.be/blog/2009/11/11/ruby-usb-libusb/</a> <a href="http://www.ruby-forum.com/topic/192042">http://www.ruby-forum.com/topic/192042</a>) . Since most of my ruby is gem installed I just need a working version of libusb so I go to the darwin ports recommended above. Looking at the &#8220;raw&#8221; port file I see that there are really only two patches and so I go find them. They aren&#8217;t exposed for reasons that seem pretty stupid to me,  but I did find them at. <a href="http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__io.c" target="_blank">http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__io.c</a> and  <a href="http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__io.c">http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__os__darwin_usb.c</a></p>
<p>When I downloaded the source file and went to wget the patches it got even more screwey.</p>
<pre>wget http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__io.c
--2010-07-06 00:28:13--  http://libusb.darwinports.com/dports/devel/libusb/files/patch-libusb__io.c
Resolving libusb.darwinports.com... 208.185.168.32
Connecting to libusb.darwinports.com|208.185.168.32|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2010-07-06 00:28:13 ERROR 403: Forbidden.</pre>
<p>I didn&#8217;t want to deal with it so I just saved the links in my browser and patched the source files manually. After that a</p>
<pre>./configure; make &amp;&amp; make install &amp;&amp; make clean</pre>
<p>let me do the normal ruby thing.</p>
<pre>gem install ruby-usb</pre>
<p>Just like on all the other operating systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/sortme/why-i-hate-darwinportsmacports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avr C programming references (linux-osx biased)</title>
		<link>http://www.osx-avr.org/avr-development/avr-c-programming-references-linux-osx-biased/</link>
		<comments>http://www.osx-avr.org/avr-development/avr-c-programming-references-linux-osx-biased/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 03:53:09 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Avr Development]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=630</guid>
		<description><![CDATA[http://en.wikipedia.org/wiki/The_Unix_Programming_Environment http://en.wikipedia.org/wiki/The_C_Programming_Language_(book) http://www.nongnu.org/avr-libc/user-manual/index.html http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC http://tom-itx.dyndns.org:81/~webpage/how_to/atmega168/mega168_howto_main_index.php]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://en.wikipedia.org/wiki/The_Unix_Programming_Environment" target="_blank">http://en.wikipedia.org/wiki/The_Unix_Programming_Environment</a></li>
<li><a href="http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)" target="_blank">http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)</a></li>
<li><a href="http://www.nongnu.org/avr-libc/user-manual/index.html" target="_blank">http://www.nongnu.org/avr-libc/user-manual/index.html</a></li>
<li><a href="http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC" target="_blank">http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC</a></li>
<li><a href="http://tom-itx.dyndns.org:81/~webpage/how_to/atmega168/mega168_howto_main_index.php" target="_blank">http://tom-itx.dyndns.org:81/~webpage/how_to/atmega168/mega168_howto_main_index.php</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/avr-c-programming-references-linux-osx-biased/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Focused workshop: Artbots 30 May 10 &#8212; PNCA ($35)</title>
		<link>http://www.osx-avr.org/electronics/focused-workshop-artbots-30-may-10-pnca/</link>
		<comments>http://www.osx-avr.org/electronics/focused-workshop-artbots-30-may-10-pnca/#comments</comments>
		<pubDate>Sat, 22 May 2010 20:36:24 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Dorkbot]]></category>
		<category><![CDATA[electronics]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=607</guid>
		<description><![CDATA[In this workshop we will be taking our dorkboards and using them to create a simple machine that draws. The focus will be on hands on problem solving. What you will get. A servo and a geared motor with paper feed. A motor driver board. Misc parts. What to bring: A dorkboard, teensy or other [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm5.static.flickr.com/4023/4633242351_c2eace7a57.jpg" alt="" width="500" height="428" /><br />
In this workshop we will be taking our dorkboards and using them to  create a simple machine that draws. The focus will be on hands on  problem solving.</p>
<p>What you will get.</p>
<ul>
<li>A servo and a geared motor with paper feed.</li>
<li>A motor driver board.</li>
<li>Misc parts.</li>
</ul>
<p>What to bring:</p>
<ul>
<li>A dorkboard, teensy or other arduino capable board.</li>
<li>A soldering iron.</li>
<li>Some basic tools (esp wire cutters, x-acto knife)</li>
<li>superglue</li>
<li>A hot glue gun.</li>
<li>foamcore or cardboard.</li>
<li>$35 or a copy of your rsvp / paypal reciept.</li>
</ul>
<p>Where:</p>
<p>PNCA &#8212; 1432 NW Johnson St, Room 205</p>
<p>When:<br />
Sunday May 30nd from 1 to 5pm </p>
<h2>How do I rsvp?</h2>
<ul>
<li>Via paypal &#8212; Select the session on the <a href="http://tempusdictum.com/tdproducts.html">TDI Products page:<br />(http://tempusdictum.com/tdproducts.html)</a>
</li>
<p>You can also rsvp via email and bring cash but it is easier to plan and track the money if you use paypal.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/electronics/focused-workshop-artbots-30-may-10-pnca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Pigs Fly &#8212; Object Space, Spokane 07-11 June 2010 ($105)</title>
		<link>http://www.osx-avr.org/electronics/making-pigs-fly-object-space-spokane-07-11-june-2010/</link>
		<comments>http://www.osx-avr.org/electronics/making-pigs-fly-object-space-spokane-07-11-june-2010/#comments</comments>
		<pubDate>Mon, 17 May 2010 00:02:53 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Avr Development]]></category>
		<category><![CDATA[electronics]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=599</guid>
		<description><![CDATA[An introduction to physical computing for artists and musicians. What: This workshop is an opportunity for 15 to 25 people to spend a week working on the fundamentals of integrating micro-controllers into the arts. At the end of the week participants should be able to build and program their own Arduino compatible micro-controller system and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://farm4.static.flickr.com/3343/4636938839_86888fa861_b.jpg" alt="" width="650" height="910" /></p>
<h3>An introduction to physical computing for artists and musicians.</h3>
<p>What:</p>
<p>This workshop is an opportunity for 15 to 25 people to spend a week working on the fundamentals of integrating micro-controllers into the arts. At the end of the week participants should be able to build and program their own Arduino compatible micro-controller system and use it to interact with the physical world using motors servos lights relays and switches.</p>
<p>The workshop will be structured with a hands on approach. The theory being that we learn best by doing. The first two days will be devoted to building and programming the base platform and using it to control various devices. The remaining 3 days will be a lab devoted to incorporating the new tools into actual pieces. The cost of the course is $105 and includes the materials listed below as well as 5 days of hands on instruction.</p>
<p>What you will get.</p>
<ul>
<li>A <a href="http://www.dorkbotpdx.org/benito">Benito</a> usb to  serial programmer</li>
<li>A <a href="http://www.dorkbotpdx.org/dorkboard">Dorkboard!</a> (an  Arduino clone) Kit</li>
<li>An introduction to the Arduino and microcontrollers  in an artists  setting</li>
<li>A servo and a geared motor with paper feed.</li>
<li>A motor driver board.</li>
<li>Misc parts.</li>
<li>Help when you need it</li>
<li>To know that what you built worked at  least once</li>
<li>Ideas</li>
</ul>
<p>What to bring:</p>
<ul>
<li>A laptop (there will be some (not many) loaner systems available)</li>
<li>A soldering iron (20-30W Pencil type)</li>
<li>A standard usb cable (A-&gt;B)</li>
<li>Some basic tools (esp wire cutters, x-acto knife)</li>
<li>superglue</li>
<li>A hot glue gun.</li>
<li>foamcore or cardboard.</li>
<li>A copy of your rsvp / paypal reciept.</li>
<li>Ideas.</li>
</ul>
<p>When:</p>
<p>June 7th through June 11th from 1-5pm.</p>
<p>Where:</p>
<p>Object Space Gallery:</p>
<p>1818 1/2 E Sprague, Spokane WA</p>
<h2>How do I rsvp?</h2>
<ul>
<li>Via paypal &#8212; go to  <a href="http://tempusdictum.com/tdproducts.html">TDI Products page: (</a><a title="http://tempusdictum.com/tdproducts.html" href="http://tempusdictum.com/tdproducts.html">http://tempusdictum.com/tdproducts.html</a>)</li>
<p>&#8211; or &#8211;</p>
<li>If you dont paypal contact me ddelmardavis , at the gmail.com directly to make other payment arrangments.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/electronics/making-pigs-fly-object-space-spokane-07-11-june-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windward Notes.</title>
		<link>http://www.osx-avr.org/sortme/windward-notes/</link>
		<comments>http://www.osx-avr.org/sortme/windward-notes/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:16:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sort Me]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=590</guid>
		<description><![CDATA[Mantras, Modularization. Simplicity. Stepwise refinement. Tools DS1306 Best code example is at .http://www.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/ only problem with sample code is that it only works in the full sp mode and the diagram on the page shows the other mode. (need a32khz crystal) To Do: Exchange for Tuesday Give walt 32khz crystals proto boards Bare lcd (maybe [...]]]></description>
			<content:encoded><![CDATA[<p>Mantras,</p>
<ul>
<li>Modularization.</li>
<li>Simplicity.</li>
<li>Stepwise refinement.</li>
</ul>
<p>Tools</p>
<p>DS1306</p>
<p>Best code example is at .<a href="http://www.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/">http://www.nearfuturelaboratory.com/2006/12/14/arduino-and-ds1306-real-time-clock/</a></p>
<p>only problem with sample code is that it only works in the full sp mode and the diagram on the page shows the other mode. (need a32khz crystal)</p>
<p>To Do:</p>
<p>Exchange for Tuesday</p>
<p>Give walt</p>
<ul>
<li>32khz crystals</li>
<li>proto boards</li>
<li>Bare lcd (maybe a temp/lcd controller board)</li>
<li>Laptop and EPC (load with ubuntu 9.10).</li>
<li>4 dorkboards.</li>
</ul>
<p>To develope.</p>
<ul>
<li>Software modules for timer and lcd.</li>
<li>Better lcd/button controller</li>
<li>led meter boards.</li>
<li></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/sortme/windward-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Paul Stoffregons&#8217;s teensy_serial arduino core on DFU based chips.</title>
		<link>http://www.osx-avr.org/avr-development/running-pauls-teensy_serial-arduino-core-on-dfu-based-chips/</link>
		<comments>http://www.osx-avr.org/avr-development/running-pauls-teensy_serial-arduino-core-on-dfu-based-chips/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 22:14:03 +0000</pubDate>
		<dc:creator>feurig</dc:creator>
				<category><![CDATA[Avr Development]]></category>
		<category><![CDATA[Dorkbot]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[DorkBotPDX]]></category>
		<category><![CDATA[teensy]]></category>
		<category><![CDATA[teensyduino]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=582</guid>
		<description><![CDATA[With a lot of my projects I have done my prototyping with Paul Stoffregon&#8217;s Teensy series of boards before moving them onto their own codebases. On those occasions where the &#8220;prototype was all I needed&#8221; I would compile the code using the teensyduino and then manually load the .hex file onto the target. As I [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/7175086@N05/4538349229/"><img src="http://farm3.static.flickr.com/2705/4538349229_21ec78bceb.jpg" alt="das blinkin" width="500" height="375" /></a><p class="wp-caption-text">das blinkin</p></div>
<p>With a lot of my projects I have done my prototyping with Paul Stoffregon&#8217;s Teensy series of boards before moving them onto their own codebases. On those occasions where the &#8220;prototype was all I needed&#8221; I would compile the code using the teensyduino and then manually load the .hex file onto the target. As I am looking at using the arduino for more projects I decided to take a look at how paul interacts with the Arduino IDE and see if I could load code directly onto my chips.</p>
<h3>boards.txt</h3>
<p>The arduino allows for different chips and configurations through the boards.txt and the programmers.txt files. Each configuration usually will also have a &#8220;core&#8221; which maps the pins and handles the particulars of that chip. When you run paul&#8217;s teensyduino installer it adds several entrys to the boards.txt file including the entry below.</p>
<pre>
<div style="width: 1px;height: 1px">teensy_ser.name=Teensy 1.0 (USB Serial)</div>
<div style="width: 1px;height: 1px">teensy_ser.upload.protocol=halfkay</div>
<div style="width: 1px;height: 1px">teensy_ser.upload.maximum_size=15872</div>
<div style="width: 1px;height: 1px">teensy_ser.upload.speed=38400</div>
<div style="width: 1px;height: 1px">teensy_ser.upload.disable_flushing=true</div>
<div style="width: 1px;height: 1px">teensy_ser.upload.avrdude_wrapper=teensy_reboot</div>
<div style="width: 1px;height: 1px">teensy_ser.build.mcu=at90usb162</div>
<div style="width: 1px;height: 1px">teensy_ser.build.f_cpu=16000000L</div>
<div style="width: 1px;height: 1px">teensy_ser.build.core=teensy_serial</div>
<div style="width: 1px;height: 1px">teensy_ser.build.post_compile_script=teensy_post_compile</div>

teensy_ser.name=Teensy 1.0 (USB Serial)
teensy_ser.upload.protocol=halfkay
teensy_ser.upload.maximum_size=15872
teensy_ser.upload.speed=38400
teensy_ser.upload.disable_flushing=true
teensy_ser.upload.avrdude_wrapper=teensy_reboot
teensy_ser.build.mcu=at90usb162
teensy_ser.build.f_cpu=16000000L
teensy_ser.build.core=teensy_serial
...</pre>
<div><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;font-size: small"><span style="line-height: 18px"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height: 19px;font-size: 13px">Looking at pauls additions to the boards.txt I see that he is using the teensy_serial core  that he has written to create a simple usb to serial interface and to map the usb avr pins and other peripherals to the arduino conventions. He is also adds an entry to the arduino uploader class which lets him use a wrapper for avrdude which lets him use his proprietary bootloader. This wrapper is installed by the Paul&#8217;s installer and  lives in the Arduino&#8217;s bin directory. After looking to see if this wrapper was a script I replaced the entry in the boards.txt and put a script into the bin directory called &#8220;dfume&#8221;, after seeing that my replacement wrapper worked I added two new entries for each class of avr that I wanted to use the atmega32u2 and the atmega32u4</span></span></span></div>
<pre>
<div style="width: 1px;height: 1px">#############################################################</div>
<div style="width: 1px;height: 1px">fouryou.name = atMega32U4</div>
<div style="width: 1px;height: 1px">fouryou.upload.protocol=atmega32u4</div>
<div style="width: 1px;height: 1px">fouryou.upload.maximum_size=32256</div>
<div style="width: 1px;height: 1px">fouryou.upload.speed=38400</div>
<div style="width: 1px;height: 1px">fouryou.upload.disable_flushing=true</div>
<div style="width: 1px;height: 1px">fouryou.upload.avrdude_wrapper=dfume</div>
<div style="width: 1px;height: 1px">fouryou.build.mcu=atmega32u4</div>
<div style="width: 1px;height: 1px">fouryou.build.f_cpu=16000000L</div>
<div style="width: 1px;height: 1px">fouryou.build.core=teensy_serial</div>
<div style="width: 1px;height: 1px">#############################################################</div>
<div style="width: 1px;height: 1px">tooyou.name = atMega32u2</div>
<div style="width: 1px;height: 1px">tooyou.upload.protocol=atmega32u2</div>
<div style="width: 1px;height: 1px">tooyou.upload.maximum_size=32256</div>
<div style="width: 1px;height: 1px">tooyou.upload.speed=38400</div>
<div style="width: 1px;height: 1px">tooyou.upload.disable_flushing=true</div>
<div style="width: 1px;height: 1px">tooyou.upload.avrdude_wrapper=dfume</div>
<div style="width: 1px;height: 1px">tooyou.build.mcu=at90usb162</div>
<div style="width: 1px;height: 1px">tooyou.build.f_cpu=16000000L</div>
<div style="width: 1px;height: 1px">tooyou.build.core=teensy_serial</div>

#############################################################

fouryou.name = atMega32U4
fouryou.upload.protocol=atmega32u4
fouryou.upload.maximum_size=32256
fouryou.upload.speed=38400
fouryou.upload.disable_flushing=true
fouryou.upload.avrdude_wrapper=dfume
fouryou.build.mcu=atmega32u4
fouryou.build.f_cpu=16000000L
fouryou.build.core=teensy_serial

#############################################################

tooyou.name = atMega32u2
tooyou.upload.protocol=atmega32u2
tooyou.upload.maximum_size=32256
tooyou.upload.speed=38400
tooyou.upload.disable_flushing=true
tooyou.upload.avrdude_wrapper=dfume
tooyou.build.mcu=at90usb162
tooyou.build.f_cpu=16000000L
tooyou.build.core=teensy_serial<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size: small"><span style="line-height: 19px">
</span></span></pre>
<p>I started with a blank script that just printed the arguments passed to the wrapper and then called it by restarting my Arduino (to reload the boards.txt) And then selecting one of the new boards and &#8220;Uploading&#8221; my code. This gave me a window to interactively work through my script. Since the avrdude_wrapper code just pretends to be an avrdude most of the script is munging the arguments passed to avrdude to get the commands to pass to dfu-programmer.</p>
<pre>#!/usr/bin/perl
use Getopt::Std;
print @ARGV;
my %args;
my $hexfile;
my $dfu = "/usr/local/bin/dfu-programmer";
my $cpu;
my $hexfile;

getopt('pUc',\%args);
$hexfile=$args{U};
$hexfile =~ s/flash:w://;
$hexfile =~ s/:i//;
$cpu=$args{c};

print "\n[" . $hexfile . "]";
print "\n[" . $cpu . "]\n";
print "$dfu $cpu erase\n";
system "$dfu $cpu erase";
print "$dfu $cpu flash $hexfile\n";
system"$dfu $cpu flash $hexfile";
print "$dfu $cpu start\n";
system "$dfu $cpu start 1&gt;&amp;2";
print "\n";</pre>
<div><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;font-size: small"><span style="line-height: 18px"><br />
</span></span></div>
<p>There is one tricky bit. The current avr-gcc doesnt support the atmega32u2 correctly but the code for the at90usb162 is binary compatible so the build.mcu is set to the at90usb162. But then dfu-programmer supports the correct chip and wont find the device so we use the fact that the upload.protocol argument is passed directlyalong using the -c argument and everything works fine.</p>
<p>So now we just use the hwb and reset buttons to get the system into dfu mode and upload our code directly from the arduino. Its not as slick as the teensy in &#8220;auto&#8221; mode but it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/running-pauls-teensy_serial-arduino-core-on-dfu-based-chips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestBox</title>
		<link>http://www.osx-avr.org/avr-development/testbox/</link>
		<comments>http://www.osx-avr.org/avr-development/testbox/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 05:14:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Avr Development]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=575</guid>
		<description><![CDATA[The testbox is an LCD/Dorkboard based arduino clone with two buttons and a pair of potentiometers. The switches, power and 4 io pins are made avaliable via screw terminals on the ouside of the testbox. #include /*-------------------------------------------------------------- pulse generator for test box Depending on the setting of left dial send send pulses out on digital [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://farm3.static.flickr.com/2724/4426061650_9e17cde48f.jpg" alt="" width="500" height="375" /></p>
<p>The testbox is an LCD/Dorkboard based arduino clone with two buttons and a pair of potentiometers. The switches, power and 4 io pins are made avaliable via screw terminals on the ouside of the testbox.</p>
<p><img class="alignnone" src="http://farm3.static.flickr.com/2690/4427260485_35af99753f.jpg" alt="" width="500" height="376" /></p>
<p><code><br />
#include <LiquidCrystal.h><br />
/*--------------------------------------------------------------<br />
pulse generator for test box</p>
<p>Depending on the setting of left dial send send pulses out on digital ouput pin 2<br />
at between 1 and 122 hz when left button is pressed.<br />
the lcd should show the hz and the number of pulses sent.</p>
<p>*/</p>
<p>//defines for analog "dial" pins.<br />
#define D1PIN 0<br />
#define D2PIN 1<br />
//defines for switches<br />
#define S1PIN 17<br />
#define S2PIN 16<br />
// other pins avaliable for testbox 2, 3, 4, 13<br />
#define PULSEPIN 2</p>
<p>// defines for smooting (nsamples) and debounce (milliseconds)<br />
#define SMOOTHING 16<br />
#define DEBOUNCE 50</p>
<p>//defines to map pins to lcd<br />
#define D4 7<br />
#define D5 8<br />
#define D6 9<br />
#define D7 10<br />
#define RW 11<br />
#define E 6<br />
#define RS 12<br />
#define BL 5</p>
<p>LiquidCrystal lcd(RS, RW, E, D4, D5, D6, D7);</p>
<p>int d1 = 0, d2 = 0, s1=0, s2=0;</p>
<p>/* variables for debouncing switches and knobs */<br />
int s1reading = 0 , s1previous = 0;<br />
long int d1sum = 0, d2sum = 0, s1time=0;<br />
int samples = 0;</p>
<p>volatile int overflowcount;<br />
volatile int pulsecount;<br />
volatile int pinstate=HIGH;</p>
<p>ISR(TIMER2_OVF_vect) {<br />
if (s1) {<br />
if (++overflowcount &gt; d1) {<br />
overflowcount=0;<br />
pinstate=!pinstate;<br />
digitalWrite(PULSEPIN,pinstate);<br />
if ( pinstate ) {<br />
pulsecount++;<br />
}<br />
}<br />
}<br />
}</p>
<p>void setup()<br />
{ overflowcount = 0;<br />
pulsecount = 0;</p>
<p>delay(1000);</p>
<p>lcd.begin(2,16);  // Print a message to the LCD.<br />
pinMode(S1PIN, INPUT);<br />
digitalWrite(S1PIN, HIGH);<br />
pinMode(S2PIN, INPUT);<br />
digitalWrite(S2PIN, HIGH);<br />
lcd.setCursor(0,0);<br />
lcd.print("  ");</p>
<p>TCCR2A = 0;                //freerunning timer 2<br />
TCCR2B = (CS21|CS22);      //divide clock by 256<br />
TIMSK2 = TOIE1;            //enable timer2 terrupt</p>
<p>}</p>
<p>void loop()<br />
{</p>
<p>s2 = !digitalRead(S2PIN); //read s2 for grins or DEBOUNCE as below.</p>
<p>//DEBOUNCE s1<br />
s1reading = digitalRead(S1PIN);</p>
<p>// If the switch changed, due to bounce or pressing...<br />
if (s1reading != s1previous) {<br />
// reset the debouncing timer<br />
s1time = millis();<br />
}</p>
<p>if ((millis() - s1time) &gt; DEBOUNCE) {<br />
if (s1 == s1reading) { // if DEBOUNCEd reading is a change<br />
s1=!s1reading;<br />
if (s1) {<br />
pulsecount=0;<br />
}<br />
}<br />
}<br />
s1previous = s1reading;</p>
<p>d1sum += analogRead(D1PIN);<br />
d2sum += analogRead(D2PIN);<br />
if (++samples &gt; SMOOTHING) {  //when i have SMOOTHING samples then average them.<br />
d1sum /= SMOOTHING;<br />
d2sum /= SMOOTHING;</p>
<p>d1=map(d1sum,0,1023,0,122); //map dial to what you want values to be<br />
d2=map(d2sum,0,1023,0,300);</p>
<p>samples=0;<br />
d1sum = 0;<br />
d2sum = 0;<br />
}</p>
<p>lcd.setCursor(0,0);<br />
lcd.print("Rate:           ");<br />
lcd.setCursor(6,0);<br />
lcd.print(122-d1);<br />
lcd.print("Hz ");</p>
<p>lcd.setCursor(0,1);<br />
if (s1) {<br />
lcd.print("ON ");<br />
} else {<br />
lcd.print("OFF");<br />
}<br />
lcd.setCursor(6,1);<br />
lcd.print("#         ");<br />
lcd.setCursor(8,1);<br />
lcd.print(pulsecount);<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/testbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reprogramming your avr-usb device using atmel&#8217;s built in bootloader</title>
		<link>http://www.osx-avr.org/avr-development/reprogramming-your-avr-usb-device-using-atmels-built-in-bootloader/</link>
		<comments>http://www.osx-avr.org/avr-development/reprogramming-your-avr-usb-device-using-atmels-built-in-bootloader/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 21:45:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Avr Development]]></category>
		<category><![CDATA[benito]]></category>
		<category><![CDATA[Dorkbot]]></category>
		<category><![CDATA[DorkBotPDX]]></category>
		<category><![CDATA[tdi]]></category>

		<guid isPermaLink="false">http://www.osx-avr.org/?p=567</guid>
		<description><![CDATA[Getting code onto the MidiMonster or Benito device. All of the code on the Benito and MidiMonster devices is open source and references an open source library called the Lightweight Usb For Avr (lufa). Getting the code compiled and onto the device requires a few other open source tools. AVR-GCC The most current and stable [...]]]></description>
			<content:encoded><![CDATA[<h3>Getting code onto the MidiMonster or Benito device.</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div class="wp-caption alignnone" style="width: 250px"><a href="http://www.flickr.com/photos/7175086@N05/4404887952/"><img src="http://farm3.static.flickr.com/2717/4404887952_d72836dabc_m.jpg" alt="Midi Monster Button Locations." width="240" height="180" /></a><p class="wp-caption-text">Midi Monster Button Locations.</p></div></td>
<td>
<p><div class="wp-caption alignnone" style="width: 250px"><a href="http://www.flickr.com/photos/7175086@N05/4404887950/in/photostream/"><img src="http://farm5.static.flickr.com/4068/4404887950_8b951295db_m.jpg" alt="Benito 7g Switch Positions." width="240" height="180" /></a><p class="wp-caption-text">Benito 7g Switch Positions.</p></div></td>
</tr>
<tr>
<td>
<p><div class="wp-caption alignnone" style="width: 250px"><a href="http://www.flickr.com/photos/7175086@N05/4404887938/in/photostream/"><img src="http://farm3.static.flickr.com/2752/4404887938_92aa8c439b_m.jpg" alt="Benito 2010 Switch Locations" width="240" height="180" /></a><p class="wp-caption-text">Benito 2010 Switch Locations</p></div></td>
<td>
<p><div class="wp-caption alignnone" style="width: 250px"><a href="http://www.flickr.com/photos/7175086@N05/4404887926/in/photostream/"><img title="Benito Without Buttons." src="http://farm5.static.flickr.com/4066/4404887926_a264eca548_m.jpg" alt="Benito Without Buttons." width="240" height="180" /></a><p class="wp-caption-text">Benito Without Buttons.</p></div></td>
</tr>
</tbody>
</table>
<p>All of the code on the Benito and MidiMonster devices is open source and references an open source library called the Lightweight Usb For Avr (lufa). Getting the code compiled and onto the device requires a few other open source tools.</p>
<h3>AVR-GCC</h3>
<p>The most current and stable release of the toochain for the AVR has untill recently been maintained by Eric Wedddington and released as WinAvr (<a href="http://sourceforge.net/projects/winavr/" target="_blank">http://sourceforge.net/projects/winavr/</a>) Winaver integrates nicely into atmels avr studio <a href="http://" target="_blank">http://www.atmel.com/dyn/Products/tools_card.asp?tool_id=2725</a> and I reccomend that you get both if you are running windows. Each Winavr Release is closely followed by objective developments CrossPack for avr <a href="http://www.obdev.at/products/crosspack/index.html" target="_blank">http://www.obdev.at/products/crosspack/index.html</a> and a <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;t=42631" target="_blank">script for building the current toolchain on linux</a> which is hosted by AvrFreaks at present there is also a debian package that was put out last month <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;t=90172" target="_blank">http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;t=90172</a></p>
<h3>HWB? DFU?</h3>
<p>Most Atmel &#8220;atmega&#8221; devices have a pin dedicated to determining weather or not the device goes into the bootloader depending on the devices flag settings. This pin is labled HWB (for hardware boot) on most of  the datasheets. The usb avr family has this mode set up by default. When you hold the hwb pin low and reset the device it goes into the bootloader. On these devices the built in bootloader uses a usb device class called the Device Firmware Uploader (DFU). Atmel provides a tool called flip for programming DFU devices on  windows and linux. There is an open source programmer called dfu-programmer <a href="http://dfu-programmer.sourceforge.net/" target="_blank">http://dfu-programmer.sourceforge.net/</a></p>
<h4>That other guys stuff.</h4>
<p>Those of you who have worked with the teensy boards from paul stoffregon will notice some subtle differences. Paul wrote his own (closed source) bootloader rather than use the bootloader tha comes installed on the chips. Then he uses a hardware trick similar to the auto reset hack to make a single button manipulate both the reset and the hwb pins to put his boards into the bootloader. I didnt feel that either the two button arrangement or the builtin bootloaders were broken so I like most people working with these chips dont fix them.</p>
<h4>Using the dfu-programmer</h4>
<p>All of the programs in Dean Cameras Lightweight Usb for Avr have a &#8220;dfu&#8221; target. Once you have the target into the DFU mode you can simply</p>
<pre>$make dfu</pre>
<p>This will cause the dfu-programmer to erase the flash reprogramm it with a new hex file and restart the chip. You can also do this manually with the following commands</p>
<pre>$dfu-programmer atmega32u2 erase
$dfu-programmer atmega32u2 flash mycode.hex
$dfu-programmer atmega32u2 start</pre>
<p>This will cause the dfu-programmer to erase the flash reprogramm it with a new hex file and restart the chip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.osx-avr.org/avr-development/reprogramming-your-avr-usb-device-using-atmels-built-in-bootloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
