<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6388203843073594887</id><updated>2012-01-18T20:42:46.640-08:00</updated><category term='i2c hmc5843 atmel avr'/><category term='Makefile arduino'/><category term='fat32 embedded openlog sdhc sdcard mmc example source arduino atmel'/><category term='smpte avr'/><category term='github'/><category term='lcd 7-segment arduino'/><category term='avr assembly i2c example'/><category term='SD SDHC flash memory latency erase'/><category term='attiny uart serial'/><category term='qrcode arduino embedded'/><category term='strobe'/><category term='attiny connector avr isp programming'/><category term='attiny led V1 Radar detector'/><category term='avrtiny adxl345 megabaud'/><category term='valentine radar led arduino'/><category term='Atmel bootstrap FAT32 SDHC'/><category term='qrcode image processing finder histogram'/><category term='jpeg eyefi embedded'/><category term='magnetometer sparkfun hmc5843 decoupling arduino'/><category term='qrcode arduino embedded tutorial'/><category term='tutorial embedded realtime queues'/><category term='google chrome bugs'/><category term='avr atmel high voltage serial programming flash dragon'/><category term='avr dragon attiny'/><category term='attiny uart serial megabaud'/><category term='linux ftdi arduino reset'/><category term='i2c lcd display attiny'/><category term='avr attiny i2c adxl345 macro assembler'/><category term='embedded arduino bluetooth programming'/><category term='harley leak spot drip gasoline oil'/><category term='arduino strobe led'/><category term='ubuntu karmic grub2 x upgrade boot linux polkit-1 swap'/><category term='qrcode display newhaven'/><category term='attiny lcd port expander i2c accelerometer assembly'/><category term='attiny megabaud macro assembler'/><category term='ios mdns ipod ipad'/><category term='netpbm graphic formats conversion scripting'/><category term='lcd i2c arduino 3.3v newhaven display'/><category term='avr attiny i2c serial adxl345 accelerometer'/><category term='android bluetooth'/><category term='fat32 sdhc jpegtrigger eyefi'/><category term='avr arduino spi sdhc tutorial howto optimize'/><category term='sparkfun jpeg serial camera'/><category term='v1 radar detector attiny'/><category term='arduino strobe xenon timing'/><category term='teensy timing input capture usb atmel avr acm'/><category term='gpsd minigpsd maemo harley j1850 radar v1 kml'/><category term='sparkfun arduino i2c pullup current mirror'/><category term='debug led tips'/><category term='QRcode image processing'/><category term='avr attiny dragon programming flashing avrdude'/><category term='motorcycle crosscountry weather radar harley'/><category term='jpeg embedded huffman compression'/><category term='minigpsd gps maemo'/><title type='text'>HarleyHacking</title><subtitle type='html'>iPod, Arduino, Nokia Tablet, GPS and other projects, generally opensource I'm adding to or using on my Night Train.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default?start-index=101&amp;max-results=100'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>110</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2171922874124969623</id><published>2011-09-19T05:44:00.000-07:00</published><updated>2011-09-19T05:44:59.439-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android bluetooth'/><title type='text'>Android media devices - a really, really annnoying flaw: no bluetooth microphone (headset) support</title><content type='html'>Woot has the Samsung Galaxy S 5 inch wifi device on sale sunday.&amp;nbsp; I have a Toshiba Thrive, but this would have been ideal as a replacement for the cell phone I use on my bike.&amp;nbsp; Well almost.&amp;nbsp; My cell (a Motorola Cliq) runs Froyo as does the samsung.&amp;nbsp; Looking at the specs (not easy to find), just like my Thrive, &lt;b&gt;IT DOES NOT SUPPORT THE BLUETOOTH HEADSET PROFILE&lt;/b&gt;.&amp;nbsp; I hope they fix this in IceCreamSandwich.&amp;nbsp; I can plug in an external wired headset into my Thrive, but sometimes that is quirky and defeats the purpose of having bluetooth.&amp;nbsp; If I want to use Skype, Fring, Tango, a CSipsimple, or GrooVe IP, I'm stuck in wired headset or speakerphone mode.&amp;nbsp; I haven't checked if a rooted device can have this added, but it is a stupid and glaring omission.&amp;nbsp; Every phone device supports it so it isn't like there is some complex software change necessary.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2171922874124969623?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2171922874124969623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/android-media-devices-really-really.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2171922874124969623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2171922874124969623'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/android-media-devices-really-really.html' title='Android media devices - a really, really annnoying flaw: no bluetooth microphone (headset) support'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1694318567443631777</id><published>2011-09-09T07:13:00.000-07:00</published><updated>2011-09-09T07:13:47.902-07:00</updated><title type='text'>iPrefer my android phone</title><content type='html'>It is only a Motorola Cliq with Froyo, but I only had the occasional problem, but they were easily resolved.&amp;nbsp; No temperature warning screens.&amp;nbsp; The Dolphin HD browser crashed a few times but I could restart it (my instrument cluster is really stressful, and I had Waze and other things going on).&amp;nbsp; The only hiccup is that it needs something unusual to charge - I don't know what.&amp;nbsp; I have a plain USB cable, which will turn it on but not charge it.&amp;nbsp; I'm using a charging tip and cable from one of my battery packs, and that works.&amp;nbsp; If I just use a plain cable, it doesn't.&amp;nbsp; But my mifi does the same thing.&lt;br /&gt;&lt;br /&gt;So far, it is far better than iOS - which also crashes, and they still haven't fixed the problem with the compromised SSL certs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1694318567443631777?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1694318567443631777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/iprefer-my-android-phone.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1694318567443631777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1694318567443631777'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/iprefer-my-android-phone.html' title='iPrefer my android phone'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6779198045134416809</id><published>2011-09-09T06:49:00.000-07:00</published><updated>2011-09-09T06:49:20.727-07:00</updated><title type='text'>Ain't too proud to Bleg...</title><content type='html'>My avnet contest videos about my harley experiments are at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=BwRO-HOUpLY"&gt;http://www.youtube.com/watch?v=BwRO-HOUpLY&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=z8ij9axe_qc"&gt;http://www.youtube.com/watch?v=z8ij9axe_qc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Please like the video since I can win an iPad.&amp;nbsp; Not that I particularly like iPads, but there is Gazelle so I can get another Thrive or Android phone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6779198045134416809?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6779198045134416809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/aint-too-proud-to-bleg.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6779198045134416809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6779198045134416809'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/aint-too-proud-to-bleg.html' title='Ain&apos;t too proud to Bleg...'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4311890162757849647</id><published>2011-09-07T08:42:00.000-07:00</published><updated>2011-09-07T09:19:54.568-07:00</updated><title type='text'>Atmel ATtiny4313 as bluetooth, first post.</title><content type='html'>&lt;div&gt;This is a quick post for comments.&lt;br /&gt;The bluetooth module is available from Seeed studios which has a &lt;a href="http://seeedstudio.com/wiki/index.php?title=Serial_port_bluetooth_module_%28Master/Slave%29"&gt;wiki page&lt;/a&gt; with the pinouts, etc.&lt;br /&gt;There are many clones - this is a very standard module.&amp;nbsp; I use some 12v 3mm LEDs (with internal resistor) for all kinds of things which I got from Digikey - they are available in red, yellow, or green, so I placed one across PD1 and Ground - it blinks while searching and goes solid on a connection.&lt;br /&gt;Before attaching to the 4313, I used a 3.3v FTDI connection (I could have used the nokia serial cable from the transport entry as well).&amp;nbsp; That let me set the baud rate and PIN.&lt;br /&gt;The project was originally in &lt;a href="http://harleyhacking.blogspot.com/2011/04/j1850-to-bluetooth.html"&gt;my earlier post on j1850 to bluetooth&lt;/a&gt; which includes another source for the part and a pointer to the serial code archive.&amp;nbsp; One note with the bluetooth module - it has a short timeout so when you do AT+PIN=1234, you can't type it, you must do a copy-paste or something like "echo AT+... &amp;gt;/dev/ttyUSB0" instead of manually typing in on a terminal&lt;br /&gt;I have a hot job at work, but will be posting more details and the code, but if you are in a hurry, &lt;a href="https://github.com/tz1/webgpsd/blob/master/avr-j1850.zip?raw=true"&gt;a version that does I2C is at my github repo&lt;/a&gt;&lt;br /&gt;See also the &lt;a href="http://harleyhacking.blogspot.com/2011/04/attiny-tip-solder-resonator-on-top.html"&gt;tip from April about soldering the resonator on top&lt;/a&gt; of the Atmel devices.&lt;br /&gt;Sorry for the low quality, but here's a handsketch of the schematic:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh6.ggpht.com/-ag8vPusGMeg/TmeXpQQhw0I/AAAAAAAAGDk/kRngVoOkJkc/IMG_20110907_120424.png" /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4311890162757849647?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4311890162757849647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/atmel-attiny4313-as-bluetooth-first.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4311890162757849647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4311890162757849647'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/09/atmel-attiny4313-as-bluetooth-first.html' title='Atmel ATtiny4313 as bluetooth, first post.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/-ag8vPusGMeg/TmeXpQQhw0I/AAAAAAAAGDk/kRngVoOkJkc/s72-c/IMG_20110907_120424.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2588615471768593293</id><published>2011-08-13T16:42:00.000-07:00</published><updated>2011-08-13T16:42:57.279-07:00</updated><title type='text'>Moving my server</title><content type='html'>If you have trouble with any URLs pointed at zdez.org, try zdez.com.&amp;nbsp; Zdez.org should work during the transition, but jut in case :).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2588615471768593293?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2588615471768593293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/08/moving-my-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2588615471768593293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2588615471768593293'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/08/moving-my-server.html' title='Moving my server'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-369862121636677122</id><published>2011-08-05T10:21:00.000-07:00</published><updated>2011-08-05T19:35:34.891-07:00</updated><title type='text'>Blank is Beautiful, or why I will never return to Google Plus</title><content type='html'>&lt;a href="http://www.maxheadroom.com/mh_episode_16.html"&gt;http://www.maxheadroom.com/mh_episode_16.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="speaker"&gt;Computer Court 9:&lt;/span&gt;       "Guilty. Take her down."&lt;br /&gt;&lt;span class="speaker"&gt;Convicted Blank:&lt;/span&gt;       "I know my rights. I won't be judged by a machine!"&lt;br /&gt;&lt;span class="speaker"&gt;Dragul:&lt;/span&gt;       "You don't have any rights. You're a Blank."&lt;br /&gt;&lt;span class="speaker"&gt;Convicted Blank:&lt;/span&gt;       "Blank is beautiful! Blank is beautiful! Blank is       beautiful!"&lt;br /&gt;&lt;br /&gt;Read the whole episode at the link.&amp;nbsp; Pseudonymity (not Anonymity) is something valuable.&amp;nbsp; I've had the same google profile for many years, and the identity long before that.&amp;nbsp; It was good enough for Buzz.&amp;nbsp; It is good enough elsewhere.&amp;nbsp; Not for Google Plus.&amp;nbsp; They suspended my account.&lt;br /&gt;&lt;br /&gt;Note.&amp;nbsp; &lt;b&gt;Data Liberation is&lt;/b&gt; &lt;b&gt;A BIG LIE&lt;/b&gt;. When the data isn't captive (like when your account isn't suspended), you don't need it.&amp;nbsp; &lt;b&gt;When it is suspended, your data is captive and you cannot liberate it&lt;/b&gt;.&amp;nbsp; I tried.&amp;nbsp; It said zero bytes for my plus1s and my stream an the rest - I haven't looked at the JSON, but I'm reasonably sure the data is gone since I deleted my public profile.&lt;br /&gt;&lt;br /&gt;I would not mind having more details available, but not easily accessible to any robo-bigot including those run by Google.&lt;br /&gt;&lt;br /&gt;They could require an email and a click through and delay several minutes and/or require a catchpa.&amp;nbsp; Or require me to approve access (or require them to be in one of MY circles, or even having been added to theirs for some length of time).&lt;br /&gt;&lt;br /&gt;They have the full information since I have Google Checkout so they have my credit card info in detail.&lt;br /&gt;&lt;br /&gt;But they want everyone outed on Google Plus.&amp;nbsp; Various groups don't need &lt;a href="http://www.youtube.com/watch?v=7skPnJOZYdA&amp;amp;feature=player_embedded"&gt;encouragement via hot air&lt;/a&gt;, they need a safe place they can explore and see who they really are.&amp;nbsp; "It gets better - but we are going to make your life a living hell by outing you before that happens with G+ 'community standards'".&amp;nbsp; I'm waiting for some organization to scan the profiles for the "Other" setting for Gender then (snail) mailing or phoning offers of a cure. &amp;nbsp; &amp;nbsp;edit - note I'm not a member of those groups, but a civil libertarian. &amp;nbsp;just after 9/11 "towelheads" were killed, we know what happened in the 1940's and in the Southern USA. &amp;nbsp;And in the century before, Catholics were fair game.&lt;br /&gt;.&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-369862121636677122?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/369862121636677122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/08/blank-is-beautiful-or-why-i-will-never.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/369862121636677122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/369862121636677122'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/08/blank-is-beautiful-or-why-i-will-never.html' title='Blank is Beautiful, or why I will never return to Google Plus'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5224692699967338488</id><published>2011-07-23T19:18:00.000-07:00</published><updated>2011-07-23T19:18:19.641-07:00</updated><title type='text'>J1850 interface update</title><content type='html'>I have one of my old CR-42 nokia serial interfaces that uses 3.3v, but provides 5v going to one of my AVR 4313s with a resonator instead of trying to go I2C.&amp;nbsp; I couldn't get all the data across the I2C at 100kHz so I moved it to a serial port.&lt;br /&gt;&lt;br /&gt;I stripped the plastic part off exposing pads for all the connections including 5v, so I have 5v, ground, tx and rx going to the AVR, and a wire going to J1850 (relying on a common ground).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5224692699967338488?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5224692699967338488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/07/j1850-interface-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5224692699967338488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5224692699967338488'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/07/j1850-interface-update.html' title='J1850 interface update'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7064441115393766385</id><published>2011-07-01T19:11:00.000-07:00</published><updated>2011-07-01T19:11:46.651-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ios mdns ipod ipad'/><title type='text'>iOS 3x speed increase for my instrument cluster app</title><content type='html'>But first another reason the crippled iOS is only magical in the sense it is something that makes me want to burn it at the stake.&lt;br /&gt;&lt;br /&gt;I go running.&amp;nbsp; I send articles to my kindle and it reads them to me.&amp;nbsp; Easy - but it doesn't read the web page, so the upload is an extra step.&lt;br /&gt;&lt;br /&gt;The iPodTouch has voicover, so I should just be able to use that.&amp;nbsp; No.&amp;nbsp; First it takes some setup.&amp;nbsp; A triple press&amp;nbsp; of the one button (I'm surprised they don't have a shift, option, control, and apple key) can bring it up.&amp;nbsp; OK, it is now almost impossible to navigate, but I can select a paragraph and two fingers down will start speaking.&amp;nbsp; Until I tilt it - then it speaks "landscape", and stops.&amp;nbsp; Then maybe "Portrait".&amp;nbsp; There is an orientation lock buried in the multiask menu.&lt;br /&gt;&lt;br /&gt;Ok, so I've found a long article, press play, put it in my fanny pack... and after about 50 feet it starts back at the top.&amp;nbsp; I didn't do anything, I didn't touch the screen, but maybe "shake" does something.&amp;nbsp; Why can't I have a "just push play" that would read audio.&amp;nbsp; In the background.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well, that is why this is an HTML5 webapp, not a native one.&lt;br /&gt;&lt;br /&gt;But even that they can't do right.&lt;br /&gt;&lt;br /&gt;The critical change was to rewrite the URL links to be the IP address.&amp;nbsp; I originally used the mDNS names, e.g. charley.local (for chumby-harley), so the motorcycle instrument cluster would be http://charley.local:2947/hogstat.html, the link itself being "hogstat.html".&amp;nbsp; I only got 2-3 updates per second.&amp;nbsp;&amp;nbsp; I&amp;nbsp; modified webgpsd to prepend the IP address, so it would be "http://192.168.1.5:2947/hogstat.html".&amp;nbsp;&amp;nbsp; I am getting 8-12 or maybe more updates per second!&lt;br /&gt;&lt;br /&gt;Ordinary DNS seems a bit slower but does appear to be cached.&amp;nbsp; But why not mDNS?&amp;nbsp; It isn't as if the IP is likely to change in a fraction of a second.&amp;nbsp; Even a 30 second cache would help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7064441115393766385?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7064441115393766385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/07/ios-3x-speed-increase-for-my-instrument.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7064441115393766385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7064441115393766385'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/07/ios-3x-speed-increase-for-my-instrument.html' title='iOS 3x speed increase for my instrument cluster app'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7918123679147507406</id><published>2011-06-16T19:10:00.000-07:00</published><updated>2011-06-16T19:10:03.457-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smpte avr'/><title type='text'>AVR SMPTE ltc (audio time code) generator</title><content type='html'>&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;This uses OCRA to generate a SMPTE time code waveform starting at 0 using a 16 bit counter.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;The timing is set for a 12Mhz ceramic resonator, ports are set for a ATtiny4313.  Released under GPLv3&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;Cut Here ----------------&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#include &lt;span style="font-size: small;"&gt;&amp;lt;&lt;/span&gt;avr/io.h&amp;gt;&lt;br /&gt;#include &lt;span style="font-size: small;"&gt;&amp;lt;a&lt;/span&gt;vr/interrupt.h&amp;gt;&lt;br /&gt;#include &lt;span style="font-size: small;"&gt;&amp;lt;&lt;/span&gt;avr/sleep.h&amp;gt;&lt;br /&gt;#include &lt;span style="font-size: small;"&gt;&amp;lt;&lt;/span&gt;string.h&amp;gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;#define CPUFREQ 12000000 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;unsigned char frame = 0, secs = 0, mins = 0, hour = 0;&lt;br /&gt;void incsmpte()&lt;br /&gt;{&lt;br /&gt;    frame++;&lt;br /&gt;    if ((frame &amp;amp; 0x0f) &amp;gt; 9)&lt;br /&gt;        frame += 6;&lt;br /&gt;    if (frame &amp;lt; 0x30)&lt;br /&gt;        return;&lt;br /&gt;    frame = 0;&lt;br /&gt;    secs++;&lt;br /&gt;    if ((secs &amp;amp; 0x0f) &amp;gt; 9)&lt;br /&gt;        secs += 6;&lt;br /&gt;    if (secs &amp;lt; 0x60)&lt;br /&gt;        return;&lt;br /&gt;    secs = 0;&lt;br /&gt;    mins++;&lt;br /&gt;    if ((mins &amp;amp; 0x0f) &amp;gt; 9)&lt;br /&gt;        mins += 6;&lt;br /&gt;    if (mins &amp;lt; 0x60)&lt;br /&gt;        return;&lt;br /&gt;    mins = 0;&lt;br /&gt;    hour++;&lt;br /&gt;    if ((hour &amp;amp; 0x0f) &amp;gt; 9)&lt;br /&gt;        hour += 6;&lt;br /&gt;    if (hour &amp;lt; 0x24)&lt;br /&gt;        return;&lt;br /&gt;    hour = 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;unsigned char user[8] = {2,4,6,8,1,3,5,7};&lt;br /&gt;static unsigned char block[10];&lt;br /&gt;void fillblock()&lt;br /&gt;{&lt;br /&gt;    block[0] = (user[0] &amp;lt;&amp;lt; 4) | ( frame &amp;amp; 0xf );&lt;br /&gt;    block[1] = (user[1] &amp;lt;&amp;lt; 4) | ( frame &amp;gt;&amp;gt; 4 );&lt;br /&gt;    block[2] = (user[2] &amp;lt;&amp;lt; 4) | ( secs &amp;amp; 0xf );&lt;br /&gt;    block[3] = (user[3] &amp;lt;&amp;lt; 4) | ( secs &amp;gt;&amp;gt; 4 );&lt;br /&gt;    block[4] = (user[4] &amp;lt;&amp;lt; 4) | ( mins &amp;amp; 0xf );&lt;br /&gt;    block[5] = (user[5] &amp;lt;&amp;lt; 4) | ( mins &amp;gt;&amp;gt; 4 );&lt;br /&gt;    block[6] = (user[6] &amp;lt;&amp;lt; 4) | ( hour &amp;amp; 0xf );&lt;br /&gt;    block[7] = (user[7] &amp;lt;&amp;lt; 4) | ( hour &amp;gt;&amp;gt; 4 );&lt;br /&gt;    block[8] = 0xfc;&lt;br /&gt;    block[9] = 0xbf;&lt;br /&gt;&lt;br /&gt;    unsigned char par, i;&lt;br /&gt;    par = 1; // last two constants&lt;br /&gt;    for (i = 0; i &amp;lt; 8; i++)&lt;br /&gt;        par ^= block[i];&lt;br /&gt;    par ^= par &amp;gt;&amp;gt; 4;&lt;br /&gt;    par ^= par &amp;gt;&amp;gt; 2;&lt;br /&gt;    par ^= par &amp;gt;&amp;gt; 1;&lt;br /&gt;    if (par &amp;amp; 1)&lt;br /&gt;        block[3] |= 8;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;unsigned char step = 0;&lt;br /&gt;unsigned char oneflg = 0;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;#define WIUONE (CPUFREQ/4800)&lt;br /&gt;ISR(TIMER1_COMPA_vect)&lt;br /&gt;{&lt;br /&gt;    if (oneflg) {&lt;br /&gt;        OCR1A += WIDONE;&lt;br /&gt;        oneflg = 0;&lt;br /&gt;        return;&lt;br /&gt;    }&lt;br /&gt;    if (1 &amp;amp; (block[step &amp;gt;&amp;gt; 3] &amp;gt;&amp;gt; (step &amp;amp; 7)))&lt;br /&gt;        oneflg = 1;&lt;br /&gt;    if (oneflg)&lt;br /&gt;        OCR1A += WIDONE;&lt;br /&gt;    else&lt;br /&gt;        OCR1A += WIDONE*2;&lt;br /&gt;    step++;&lt;br /&gt;    if (step == 80)&lt;br /&gt;        step = 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;unsigned hitime = 0;&lt;br /&gt;ISR(TIMER1_OVF_vect)&lt;br /&gt;{&lt;br /&gt;    hitime++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ISR(TIMER1_CAPT_vect)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**************************************************************************/&lt;br /&gt;int main(void)&lt;br /&gt;{&lt;br /&gt;    MCUCR = 0x20;               // enable sleep as idle&lt;br /&gt;    PRR = 0x06;                 // shut down USI and Timer 0&lt;br /&gt;    BODCR = 3;                  // disable brown-out detect during sleep&lt;br /&gt;    BODCR = 2;&lt;br /&gt;    DIDR = 3;&lt;br /&gt;    ACSR = 0x80;&lt;br /&gt;&lt;br /&gt;    // Select clock, etc for timer |1 = xtal/1, |2 = xtal/8,,,&lt;br /&gt;    GTCCR = 0x81;               // stop for reset - normally to sync multiples&lt;br /&gt;    TCNT1 = 0;&lt;br /&gt;    TCCR1A = 0xA0;&lt;br /&gt;    TCCR1C = 0xC0;              // force clear&lt;br /&gt;    TCCR1A = 0x50;              // now toggle&lt;br /&gt;    TCCR1B = 0xC0 | 1;          // NoiseC, edge ...  off,1,8,64,256,1024,ext&lt;br /&gt;    GTCCR = 0x80;               // start&lt;br /&gt;&lt;br /&gt;    TIFR |= 0xC8;               // reset interrupt triggers&lt;br /&gt;    TIMSK |= 0xC8;              // enable interrupt&lt;br /&gt;    DDRB = 0x18;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;// Not adjusted for CPU Freq - not using UART yet&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;    UBRRL = 12;                 //div 13 for 115200 baud from 12MHz&lt;br /&gt;    UBRRH = 0;&lt;br /&gt;&lt;br /&gt;    UCSRC = 0x06;               //8N1 (should be this from reset)&lt;br /&gt;    UCSRA = 0xE2;               // clear Interrupts, UART at 2x (xtal/8)&lt;br /&gt;    UCSRB = 0x18;               // oring in 0x80 would enable rx interrupt&lt;br /&gt;&lt;br /&gt;    sei();&lt;br /&gt;&lt;br /&gt;    for (;;) {&lt;br /&gt;        sleep_mode();           // INT will waken&lt;br /&gt;        if (step)&lt;br /&gt;            continue;&lt;br /&gt;        incsmpte();&lt;br /&gt;        fillblock();&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;avr io.h=""&gt;&lt;avr interrupt.h=""&gt;&lt;avr sleep.h=""&gt;&lt;string.h&gt; &lt;/string.h&gt;&lt;/avr&gt;&lt;/avr&gt;&lt;/avr&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7918123679147507406?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7918123679147507406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/06/avr-smpte-ltc-audio-time-code-generator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7918123679147507406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7918123679147507406'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/06/avr-smpte-ltc-audio-time-code-generator.html' title='AVR SMPTE ltc (audio time code) generator'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5515894060198058711</id><published>2011-06-15T05:44:00.000-07:00</published><updated>2011-06-15T05:44:04.480-07:00</updated><title type='text'>I2C is too slow, Serial works</title><content type='html'>There are two problems with I2C on the Chumby Hacker Board.  First, it won't run at 400kHz (high speed) without a new kernel.  Second, you need to continually poll the device.&lt;br /&gt;&lt;br /&gt;Using the ATtiny4313 with only 256 bytes of ram, it would lose data even with a 200 byte buffer (for hex, so it would be about 80 bytes of messages).  Nice -n -20 didn't resolve the problem, nor anything else I tried, so time to go serial.&lt;br /&gt;&lt;br /&gt;I have several Nokia CA-42 cables.  You can find them for around $5 from the cheap cell accessory places.  Basically they are CR210x serial adapters, but are 3.3v friendly.  Even better, if you rip off the plastic sheath, all the RS232 lines are there and a 5v passthrough.  So I went back to my serial 115200 j1850 code, removed the molded jacket on one of these, and attached it.  I modified the devgpsrc data sourcer code, and can't find a missed message.  RPM was at 15.00 messages per second, the fuel messages were all in the low 20s (this is an incrementing counter, I will see a jump of 40 or 60 if a message is missed).  All with 20Hz gps on the other channel.&lt;br /&gt;&lt;br /&gt;It did stop in the middle of the ride, but the connector might not have been seated properly.  Reseating it made it work for the rest of the ride.&lt;br /&gt;&lt;br /&gt;I will try to post some pics later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5515894060198058711?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5515894060198058711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/06/i2c-is-too-slow-serial-works.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5515894060198058711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5515894060198058711'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/06/i2c-is-too-slow-serial-works.html' title='I2C is too slow, Serial works'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8694343550297090303</id><published>2011-05-31T09:41:00.000-07:00</published><updated>2011-05-31T09:41:41.244-07:00</updated><title type='text'>Venus at 20 Hurts, iPod is hot - too hot.</title><content type='html'>The Venus 638 has a strange problem.  If it loses lock it has a very hard time regaining it at some times (this is when it knows when and where it is).  Hitting reset has it snap back and find all the satellites and lock in a few seconds.  I need to try dropping back to 10Hz to see if it still does it.&lt;br /&gt;&lt;br /&gt;Meanwhile my last ride went well until the iPod started acting strangely.  It would first dim.  Then after a while an alert screen titled "Temperature" with a yellow triangle with exclamation point came up.  It was 90 degrees, and it was in a box but not that bad.  Probably the refresh rate - the back surface did get hot.  It needed full brightness to be visible in the sun.&lt;br /&gt;&lt;br /&gt;I will need to see if I can get the kindle mounted and tweak the pages a bit more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8694343550297090303?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8694343550297090303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/venus-at-20-hurts-ipod-is-hot-too-hot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8694343550297090303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8694343550297090303'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/venus-at-20-hurts-ipod-is-hot-too-hot.html' title='Venus at 20 Hurts, iPod is hot - too hot.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5781253066866403647</id><published>2011-05-23T04:57:00.001-07:00</published><updated>2011-05-23T04:57:41.554-07:00</updated><title type='text'>My latest test setup - video</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/cJ7M54OmEsI?hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/cJ7M54OmEsI?hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5781253066866403647?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5781253066866403647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/my-latest-test-setup-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5781253066866403647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5781253066866403647'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/my-latest-test-setup-video.html' title='My latest test setup - video'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8649991167830199585</id><published>2011-05-21T18:33:00.000-07:00</published><updated>2011-05-21T18:33:33.226-07:00</updated><title type='text'>Failure modes</title><content type='html'>I finally got the 1.0 Chumby hacker board going (with the rt8188USB module).  It works 100% managed mode, but can't seem to create an access point or do some things in Ad-hoc mode.  In any case I have another ATtiny4313s for J1850, and am ready to test it.&lt;br /&gt;&lt;br /&gt;Today a test didn't go so well with two problems.  First, the j1850 keeps stopping.  I'm wondering about a problem with the I2C.  Second, the antenna wire came loose from the connector, so no GPS.  The latter is fixed now.&lt;br /&gt;&lt;br /&gt;So far things works.  I'm also thinking of creating a "chumbase station" - with two wireless connections, one that roams, one that goes to the iPod/Android/Laptop/Kindle.  Streaming an MP3 could go through a proxy that would save a complete image, so it would be part of a library so could be listened to again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8649991167830199585?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8649991167830199585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/failure-modes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8649991167830199585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8649991167830199585'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/failure-modes.html' title='Failure modes'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1160021341450900196</id><published>2011-05-15T06:01:00.000-07:00</published><updated>2011-05-15T06:01:19.243-07:00</updated><title type='text'>The Kindle is the magical device</title><content type='html'>I just got a 3G whispernet kindle.  I almost got a DX when it was on a really good deal last month from Amazon's gold box, but the DX doesn't have wifi.  But the smaller one is probably better.  800x600 eink screen - and the experimental browser works with the Chumby board - fairly complete HTML5.  Not for videos though.  And it would help if sites could check the useragent and do a grayscale friendly version (e.g. google maps), but the kindle generally does well enough.  Audiobooks I ripped play back in the audiobook folder.  &lt;br /&gt;&lt;br /&gt;No folders or organizing books, but it has only 4Gb of space, which isn't tight for books, and the mp3 player seems to pick some place in the collection at random to start or continue.  I await the kindle app store and/or upgrades.&lt;br /&gt;&lt;br /&gt;I'm looking for a 1.8v bluetooth module since there is a 4 conductor connector in one of the side slots that gives console access.&lt;br /&gt;&lt;br /&gt;It doesn't have Bonjour/mDNS/uPNP, so I can't use the harley.local type of address, I have to know the IP of the chumby hacker board.  But the web browser works on 3G.  (I did have to tweak the webgpsd code - it demands the 200 HTTP response code and such before the content).&lt;br /&gt;&lt;br /&gt;I wish it had bluetooth for a keyboard and/or headphones but I can get around.  I can also use a klip.me bookmarklet to sent webpage articles to be read on the kindle, and the text to speech works well on that.  It can read PDFs but some of the features only work if you convert them, but there is a free service via wifi.  I was looking for a way to read all the things I wanted like I do audiobooks and the kindle does it.&lt;br /&gt;&lt;br /&gt;I can't seem to put even a dent in the battery.  And it is really light weight.&lt;br /&gt;&lt;br /&gt;Oh, and you can get millions of books, most inexpensively.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1160021341450900196?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1160021341450900196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/kindle-is-magical-device.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1160021341450900196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1160021341450900196'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/kindle-is-magical-device.html' title='The Kindle is the magical device'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-532031821821603983</id><published>2011-05-08T17:54:00.000-07:00</published><updated>2011-05-08T17:54:12.708-07:00</updated><title type='text'>Hackerboard version pix</title><content type='html'>This is the setup, though packed in a box when on my bike today.  I've been fixing bugs as I went (literally, stopped to eat and hack).  I've changed the I2C firmware in the 4313 to nak if no data, but to only send one message per transaction to make the reader code cleaner.  And tweaked the script to start webgpsd only on "ac", and fixed a number of other bugs.  All should be up on github (or elsewhere for the atmel code) shortly.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-0FZeFxLhxtk/Tcc6glyIb-I/AAAAAAAAFxI/WgUo3B3Fdgo/s1600/SAM_0022.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://4.bp.blogspot.com/-0FZeFxLhxtk/Tcc6glyIb-I/AAAAAAAAFxI/WgUo3B3Fdgo/s400/SAM_0022.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-532031821821603983?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/532031821821603983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/hackerboard-version-pix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/532031821821603983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/532031821821603983'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/hackerboard-version-pix.html' title='Hackerboard version pix'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-0FZeFxLhxtk/Tcc6glyIb-I/AAAAAAAAFxI/WgUo3B3Fdgo/s72-c/SAM_0022.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6405064095367765994</id><published>2011-05-08T06:01:00.000-07:00</published><updated>2011-05-08T06:01:59.984-07:00</updated><title type='text'>More chumby hackerboard and Venus secrets</title><content type='html'>On the hack connector there is a USB port.  It is battery powered.  The docs said only the rear USB had power on battery, but this one does too - it isn't really mentioned either way, but I have it powering the GPS with the rear port going to the small module (pics to come).  I have one of the battery doors from a real chumby (sparkfun chumby parts) that fit and works.&lt;br /&gt;&lt;br /&gt;In /sys/class/power, there is a section for "ac" (external power) so you can see if the power is online, and battery, so you can monitor the discharge.  I added a script that would kill (and flush) webgpsd when the battery started getting low, and poweroff when it got lower, but would restart webgpsd if the "ac" goes back up.  On the real chumby, I would be left with the last "current.kml" file - this was a mechanism to prevent data loss in case of a crash, and works, but isn't very neat.  With a battery, I don't need to worry.&lt;br /&gt;&lt;br /&gt;Meanwhile there are two annoyances with the Venus 638 GPS at 20Hz.  I have twice left it on overnight, and it would lose a lock (out my window where it can see half the sky).  I would expect it to lose it occasionally, but it doesn't recover until/unless I hit reset.  Also, it will favor satellite 1 (which is defective, "do not use", will never get a lock) over the WAAS satellite 46 which is visible.  It won't drop 46, but with AGPS if there are 12 satellites, even if it won't use them (e.g. too close to the horizon) it won't attempt to lock onto the WAAS satellite.&lt;br /&gt;&lt;br /&gt;AGPS is great to make locks quicker, but it might be causing some of these problems.  But it also might be when it gets the ephemeris from the satellites and remembers them it would do the same thing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6405064095367765994?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6405064095367765994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/more-chumby-hackerboard-and-venus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6405064095367765994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6405064095367765994'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/more-chumby-hackerboard-and-venus.html' title='More chumby hackerboard and Venus secrets'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2089344684978280454</id><published>2011-05-06T14:36:00.000-07:00</published><updated>2011-05-06T14:36:43.686-07:00</updated><title type='text'>Progress</title><content type='html'>Several useful thing I didn't know but should make things easier.&lt;br /&gt;&lt;br /&gt;The one battery boosted USB port can run both the GPS (as /dev/ttyUSB0) and the wireless adapter at the same time, so the I2C doesn't have to run at top speed.&lt;br /&gt;&lt;br /&gt;There is a whole power section in /sys/class where I can detect power and battery discharge, and do a "poweroff" after the motorcycle is shutoff.&lt;br /&gt;&lt;br /&gt;It still takes about 20 seconds for the USB to come up, but I can startup the GPS logging then.  I wish it were faster, but with the battery backup it will be far less of a problem.  (If I could only sleep/suspend).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2089344684978280454?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2089344684978280454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/progress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2089344684978280454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2089344684978280454'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/progress.html' title='Progress'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8366397918853376906</id><published>2011-05-06T12:15:00.000-07:00</published><updated>2011-05-06T12:15:28.234-07:00</updated><title type='text'>Test Flight, and a few problems.</title><content type='html'>It went well, though the infocast has a bit of a boot time, so I'm returning to the hackerboard.&lt;br /&gt;&lt;br /&gt;The hackerboard allows mdns to be turned on, and boots up faster, and has the battery, but the battery only powers one port (which I'm using for one of those tiny WIFI adapters).  So how to get the GPS in?  I programmed up a 4313 with a 12Mhz resonator, and it works (two addresses, one for J1850, one for UART read), but the I2C bus only runs at 100kHz so I get overruns from the 20Hz GPS (the bus itself might be fast enough, but the system overhead means I don't have time to empty it completely as it will be filling at 115.2 and after starting I will only be draining at 100).  I'm looking how to fix the timing - it is just a register, but it might need a kernel module tweak.&lt;br /&gt;&lt;br /&gt;The chumby has a UART, but it is for the console.  I suppose I could launch the GPS data reader off it somehow, but that might make getting to the console hard if/when I need to.&lt;br /&gt;&lt;br /&gt;If I can get the battery powered hacker board working, it would do everything I need.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8366397918853376906?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8366397918853376906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/test-flight-and-few-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8366397918853376906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8366397918853376906'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/test-flight-and-few-problems.html' title='Test Flight, and a few problems.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3016314061671961702</id><published>2011-05-04T10:05:00.000-07:00</published><updated>2011-05-04T10:05:26.173-07:00</updated><title type='text'>Chumby (infocast) adapted</title><content type='html'>A quick note on the ATtiny85 - it doesn't work well for J1850, at least not at 8Mhz.  It only has an 8 bit timer and pin change interrupt so I can pull the time of the edge when it is serviced, but with the USI constantly going, it will jitter enough to scramble a few messages.&lt;br /&gt;&lt;br /&gt;The 4313 (and the 84) have 16 bit timers with input capture so I don't have to service the interrupt immediately.&lt;br /&gt;&lt;br /&gt;Here is a 4313 in a 20 pin socket from radio shack folded into the infocast.  I added a USB connector in the power line and brought out the j1850 line (the grounds will be common, or I could use the common from the audio out if I'm using an isolating power supply).&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-WAcZ0M8irpg/TcGGCabDk2I/AAAAAAAAFw8/RPgVhinbOUY/s1600/DSCI0001.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-WAcZ0M8irpg/TcGGCabDk2I/AAAAAAAAFw8/RPgVhinbOUY/s320/DSCI0001.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-bHCqQDp4naQ/TcGGJgG6t3I/AAAAAAAAFxA/MXqb6nSuqrI/s1600/DSCI0002.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-bHCqQDp4naQ/TcGGJgG6t3I/AAAAAAAAFxA/MXqb6nSuqrI/s320/DSCI0002.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3016314061671961702?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3016314061671961702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-infocast-adapted.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3016314061671961702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3016314061671961702'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-infocast-adapted.html' title='Chumby (infocast) adapted'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-WAcZ0M8irpg/TcGGCabDk2I/AAAAAAAAFw8/RPgVhinbOUY/s72-c/DSCI0001.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1840208600386991135</id><published>2011-05-03T15:31:00.000-07:00</published><updated>2011-05-03T16:21:13.372-07:00</updated><title type='text'>Simplified I2C on chumby</title><content type='html'>You don't have to use the message ioctl to access the I2C on the chumby.  For the accelerometer, the code is shown below.  This actually works better for me since I don't have an address register, I just return data bytes.&lt;br /&gt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;&lt;br /&gt;&lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;linux/i2c.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;linux/i2c-dev.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;fcntl.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;stdlib.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;unistd.h&amp;gt;&lt;br /&gt;#include &lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&amp;lt;&lt;stdio.h&gt;&lt;linux i2c.h=""&gt;&lt;linux i2c-dev.h=""&gt;&lt;fcntl.h&gt;&lt;stdlib.h&gt;&lt;unistd.h&gt;&lt;sys ioctl.h=""&gt;sys/ioctl.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, char **argv) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int i2cfd;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int8_t x, y, z;&amp;nbsp; // the readings are 8 bits and signed!&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open a connection to the I2C userspace control file.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((i2cfd = open("/dev/i2c-0", O_RDWR)) &amp;lt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit(1);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ioctl(i2cfd,I2C_SLAVE,0x1D&amp;lt;&amp;lt;1) &amp;lt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit(2);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned char reg=6;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int8_t iobuf[8];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(i2cfd, &amp;amp;reg, 1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; read(i2cfd,iobuf,3);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("{\"accx\":%d,\"accy\":%d,\"accz\":%d}\n", iobuf[0], iobuf[1], iobuf[2]); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; close(i2cfd);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/sys&gt;&lt;/unistd.h&gt;&lt;/stdlib.h&gt;&lt;/fcntl.h&gt;&lt;/linux&gt;&lt;/linux&gt;&lt;/stdio.h&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1840208600386991135?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1840208600386991135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/simplified-i2c-on-chumby.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1840208600386991135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1840208600386991135'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/simplified-i2c-on-chumby.html' title='Simplified I2C on chumby'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5743546478069563260</id><published>2011-05-03T12:19:00.000-07:00</published><updated>2011-05-03T12:19:16.620-07:00</updated><title type='text'>Chumby with J1850</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-reGzBehvmoQ/TcBUHCyswsI/AAAAAAAAFw0/EvAzjPleTj0/s1600/DSCI0001.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://3.bp.blogspot.com/-reGzBehvmoQ/TcBUHCyswsI/AAAAAAAAFw0/EvAzjPleTj0/s400/DSCI0001.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;One of my 4313s 8mhz no crystal with &lt;a href="http://www.zdez.org/j1850usi.zip"&gt;a tweaked version&lt;/a&gt; attached to the chumby.  The connector from the corner is 3.3v, SDA, SCL, X, GND&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5743546478069563260?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5743546478069563260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-with-j1850.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5743546478069563260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5743546478069563260'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-with-j1850.html' title='Chumby with J1850'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-reGzBehvmoQ/TcBUHCyswsI/AAAAAAAAFw0/EvAzjPleTj0/s72-c/DSCI0001.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8489722694748728847</id><published>2011-05-03T05:39:00.000-07:00</published><updated>2011-05-03T05:39:15.395-07:00</updated><title type='text'>Chumby (infocast) already ready</title><content type='html'>An article on one of the hacking blogs I follow pointed to &lt;a href="http://dangerousprototypes.com/2011/05/01/chumby-controls-freescale-mechatronics-board-over-usb/"&gt;someone using an infocast&lt;/a&gt;.  So I reopened mine (I have both models - Actually two of the 8 inch versions, but the display won't work on the one I opened completely.&lt;br /&gt;&lt;br /&gt;Several things make this really nice.&lt;br /&gt;&lt;br /&gt;1. The hacker port is present so it has I2C ready to wire (for an ATtinyXXX j1850 reader).&lt;br /&gt;&lt;br /&gt;2. The USB recognizes the GPS board.&lt;br /&gt;&lt;br /&gt;3. mDNS Responder is already there (and with the touchscreen you can attach to Wifi easily).&lt;br /&gt;&lt;br /&gt;4. It takes the binaries I compile under scratchbox for the Nokia n8x0 tablet so webgpsd "just works".&lt;br /&gt;&lt;br /&gt;The next step is to rewrite the python feeder apps in C for the chumby.  No python on the chumby.  I have to do something for I2C to pull the J1850 but that should be easy (the wiki at ladyada has the info and I already wrote and worked with the I2C).&lt;br /&gt;&lt;br /&gt;Once in place, and after I find the 5v connector, it is onto my Harley with my iPod, android, and laptop.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8489722694748728847?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8489722694748728847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-infocast-already-ready.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8489722694748728847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8489722694748728847'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/chumby-infocast-already-ready.html' title='Chumby (infocast) already ready'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3793468251631790659</id><published>2011-05-01T07:00:00.000-07:00</published><updated>2011-05-01T07:00:39.438-07:00</updated><title type='text'>Minigpsd 0.39, webgpsd plans.</title><content type='html'>For nokia tablets, an update so that OBD/harley will work with the 4313:&lt;br /&gt;&lt;br /&gt;http://www.zdez.org/minigpsd_0.39_armel.deb&lt;br /&gt;&lt;br /&gt;The source is at&lt;br /&gt;&lt;br /&gt;http://www.zdez.org/minigpsd_0.39.tar.gz&lt;br /&gt;&lt;br /&gt;(I will update github later)&lt;br /&gt;&lt;br /&gt;Right now the biggest problem with webgpsd is to get the feeder programs (those that send the harley or gps data into webgpsd) working on all platforms.  Nokia doesn't have a recent version of bluez that uses dbus. iOS doesn't have dbus at all, and although BTstack lets me talk (great job Matthias!), I need to write something to set and maintain the connection.&lt;br /&gt;&lt;br /&gt;Longer term, the Chumby Hacker Board is at 1.0 and has an I2C which I can use for the J1850, and real USB which I can use for the GPS for both power and interface.  I was trying to do bluetooth there but it needs lots of things and Fedora abandoned full distro ARM support at fc12 (I don't know about fc15 and rawhide seems to have it).  But I don't need bluetooth for that.&lt;br /&gt;&lt;br /&gt;The problem I need to solve is to connect it wirelessly without a great deal of hassle.  Zcip is supported and I should be able to get mDNSresponder going (Avahi needs dbus).  I should be able to create a default ad-hoc network, so just browsing with any current phone, tablet, player or computer should find it (and tell it where to find a real AP).  The CHB could do the logging and web interface can pull and/or manage the logs.&lt;br /&gt;&lt;br /&gt;There is also an android project for Harleys which uses ELM-327 OBD2 bluetooth interfaces (I used them in earlier versions):&lt;br /&gt;&lt;br /&gt;https://github.com/stelian42/HarleyDroid&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3793468251631790659?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3793468251631790659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/minigpsd-039-webgpsd-plans.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3793468251631790659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3793468251631790659'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/05/minigpsd-039-webgpsd-plans.html' title='Minigpsd 0.39, webgpsd plans.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1445965692765787028</id><published>2011-04-28T15:22:00.000-07:00</published><updated>2011-04-28T16:05:53.667-07:00</updated><title type='text'>Webgpsd harley</title><content type='html'>Dashboard:&lt;br /&gt;&lt;div width: 640px; height: 640px; margin: 0px&gt;&lt;a href=/&gt;&lt;canvas id="myCanvas"&gt;No Canvas.&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;using javascript - here is a test fixture (the real one is inside webgpsd and grabs the data from webgpsd).  I need to clean it up a bit but it shows everything.&lt;br /&gt;It does run on the iPod touch (remotely, but I'm working on a Cydia version of webgpsd, but the bluetooth needs work), or any html5 canvas supporting browser.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Temp, left turnsig, right turnsig&lt;br /&gt;&lt;br /&gt;speed (mph)&lt;br /&gt;&lt;br /&gt;gear (red if clutch, neutral, 1-6, 0 for unknown like when off)&lt;br /&gt;&lt;br /&gt;fuel level&lt;br /&gt;&lt;br /&gt;rpm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script&gt;var canv,xh,wd,htvar mx = 240;var zcount = 0;function dodraw() {    var elem = document.getElementById('myCanvas')    canv = elem.getContext('2d')    wd = 640    ht = 640    canv.canvas.width = wd    canv.canvas.height = ht    mx = ht;    if( wd &lt; mx )      mx = wd;    canv.fillStyle = '#000'    canv.fillRect(0,0, wd,ht)    xh=new XMLHttpRequest()    setTimeout(update, 100)}function update() {    if( wd != window.innerWidth ||        ht != window.innerHeight ) {        wd = window.innerWidth        ht = window.innerHeight        mx = ht;        if( wd &lt; mx )            mx = wd;        canv.canvas.width = wd        canv.canvas.height = ht    }    zcount++;    var hog = {odo:0,fuel:0}    hog.rpm = zcount * 100000 % 8000000    hog.speed = zcount * 1000 % 120000     hog.gear = zcount % 6 + 1    hog.full = zcount % 6    hog.turn = (zcount &gt;&gt; 4) &amp; 3    hog.temp = zcount % 256    hog.clut = 1//(zcount &gt;&gt; 11) &amp; 1    hog.neutral = 1//(zcount &gt;&gt; 10) &amp; 1    canv.fillStyle = '#000'    canv.fillRect(0, 0, wd,ht)    r = mx/2    canv.lineWidth = r/50    canv.strokeWidth = r/50    canv.strokeStyle = '#880'    canv.beginPath()    canv.moveTo(19*r/10,r)    canv.arc(r,r,9*r/10,0,Math.PI,true)    canv.lineTo(19*r/10,r)    canv.stroke()    canv.strokeStyle = '#f00'    canv.beginPath()    canv.moveTo(19*r/10,19*r/10)    canv.arc(r,19*r/10,9*r/10,0,Math.PI,true)    canv.lineTo(19*r/10,19*r/10)    canv.stroke()    canv.lineWidth = r*4/10    canv.strokeWidth = r*4/10    canv.strokeStyle = '#CC0'    canv.beginPath()    canv.arc(r,r,7*r/10,Math.PI, Math.PI*(1+hog.speed/120000),false)    canv.stroke()    canv.strokeStyle = '#f00'    canv.beginPath()    canv.arc(r,19*r/10,7*r/10,Math.PI, Math.PI*(1+hog.rpm/8000000),false)    canv.stroke()    canv.fillStyle = '#0f0'    if( hog.turn &amp; 1 ) { canv.beginPath() canv.moveTo(19*r/10,3*r/10) canv.lineTo(17*r/10,2*r/10) canv.lineTo(17*r/10,4*r/10) canv.lineTo(19*r/10,3*r/10) canv.fill()    }    if( hog.turn &amp; 2 ) { canv.beginPath() canv.moveTo(r/10,3*r/10) canv.lineTo(3*r/10,2*r/10) canv.lineTo(3*r/10,4*r/10) canv.lineTo(r/10,3*r/10) canv.fill()    }    canv.lineWidth = r/50    canv.strokeWidth = r/50    if( hog.full &gt; 6 ) hog.full = 6;    if( hog.full &gt; 2 ) { canv.fillStyle = '#0f0' canv.strokeStyle = '#0f0'    }    else if( hog.full &gt; 1 ) { canv.fillStyle = '#ff0' canv.strokeStyle = '#ff0'    }    else { canv.fillStyle = '#f00' canv.strokeStyle = '#f00'    }    canv.beginPath()    canv.moveTo(17*r/10,r)    canv.lineTo(19*r/10,r)    canv.lineTo(19*r/10,12*r/10)    canv.lineTo(17*r/10,12*r/10)    canv.lineTo(17*r/10,r)    canv.stroke()    full = (6 - hog.full)/3*r/10;    canv.beginPath()    canv.moveTo(19*r/10,12*r/10)    canv.lineTo(17*r/10,12*r/10)    canv.lineTo(17*r/10,r+full)    canv.lineTo(19*r/10,r+full)    canv.lineTo(19*r/10,12*r/10)    canv.fill()    canv.textAlign="center"    canv.textBaseline="middle"    canv.lineWidth = r/50    canv.strokeWidth = r/50    v = r / 3    canv.font = v +"px sans-serif"    canv.fillStyle = '#fff'    canv.fillText(hog.rpm/1000, r,19*r/10-v/2)    canv.fillText(Math.round(hog.speed/1000), r,r-v/2)// clutch - neutral - gear    if( hog.gear == -1 ) hog.gear = 0;    if( !hog.neutral ) { canv.fillStyle = '#0f0' canv.fillText("N", r/5,r+v/2)    }    else if( !hog.clut ) { canv.fillStyle = '#f00' canv.fillText(hog.gear, r/5,r+v/2)    }    else { canv.fillStyle = '#fff' canv.fillText(hog.gear, r/5,r+v/2)    }    v = r / 5    canv.font = v +"px sans-serif"    canv.fillStyle = '#fff'    canv.fillText(hog.temp , 3*r/10, v)//    v = r / 10//    canv.font = v +"px sans-serif"//    canv.fillStyle = '#fff'//    line=10;//    canv.fillText(hog.odo+" ODO", r, line++* v)//    canv.fillText(hog.fuel+" FUEL", r, line++* v)    setTimeout(update, 50)}dodraw()&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1445965692765787028?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1445965692765787028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/webgpsd-harley.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1445965692765787028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1445965692765787028'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/webgpsd-harley.html' title='Webgpsd harley'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8271217026614986213</id><published>2011-04-27T14:38:00.000-07:00</published><updated>2011-04-27T14:38:59.069-07:00</updated><title type='text'>Quickie - GPS (usb) keepalive</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-VjEf52bu-Yo/TbgabFg1dvI/AAAAAAAAFwM/pdj3dVVQOrc/s1600/keepon.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://4.bp.blogspot.com/-VjEf52bu-Yo/TbgabFg1dvI/AAAAAAAAFwM/pdj3dVVQOrc/s400/keepon.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This uses a LiPo charger from Adafruit.  I have a miniB usb power source, and the venus evk board uses the same thing.  I had a spare LiPO from an old iPod booster, so created a passthrough.  The only problem is that it requires a battery.  I have some other batteries, but don't know how long I might want it.  This would keep it tracking - even thought the Venus is fast with a warmstart, sometimes it can take a few seconds and it often will take a while to reacquire a WAAS satellite.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8271217026614986213?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8271217026614986213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/quickie-gps-usb-keepalive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8271217026614986213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8271217026614986213'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/quickie-gps-usb-keepalive.html' title='Quickie - GPS (usb) keepalive'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-VjEf52bu-Yo/TbgabFg1dvI/AAAAAAAAFwM/pdj3dVVQOrc/s72-c/keepon.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2660432796998083465</id><published>2011-04-16T07:12:00.000-07:00</published><updated>2011-04-16T07:12:50.089-07:00</updated><title type='text'>J1850 to bluetooth</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-yaHbPuCFSxw/TamcnAxTNLI/AAAAAAAAFv0/a_iOxIW73dQ/s1600/DSCI0001.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://3.bp.blogspot.com/-yaHbPuCFSxw/TamcnAxTNLI/AAAAAAAAFv0/a_iOxIW73dQ/s400/DSCI0001.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The &lt;a href="http://zdez.org/j1850-x313-serial.zip"&gt;code is at my zdez site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I &lt;a href="http://www.mdfly.com/index.php?main_page=product_info&amp;cPath=8_47&amp;products_id=63"&gt;use a module from mdfly&lt;/a&gt;, but any 3.3v with ttl can be used.  This particular chip can be renamed and baud rate changed which I did with a 3.3v arduino USB interface.&lt;br /&gt;&lt;br /&gt;I'm using a low-dropout regulator from my parts box.  Any that can tolerate vehicle (12v+) should work - but many don't.  Switching regulators might also work.&lt;br /&gt;&lt;br /&gt;20 pin socket is from radio shack.&lt;br /&gt;&lt;br /&gt;(I will say "2313" for both 4313 and 2313 going forward)&lt;br /&gt;&lt;br /&gt;I'm using a 10MHz resonator soldered on top of the chip.&lt;br /&gt;&lt;br /&gt;I'm not using BT TxD to 2313 RxD, but connected it anyway.&lt;br /&gt;The connections to the 2313 are just V+, GND, TxD, and RxD, and the ICP1 on pin 11 across from ground to a 10k resistor that goes to the J1850 line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2660432796998083465?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2660432796998083465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/j1850-to-bluetooth.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2660432796998083465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2660432796998083465'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/j1850-to-bluetooth.html' title='J1850 to bluetooth'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-yaHbPuCFSxw/TamcnAxTNLI/AAAAAAAAFv0/a_iOxIW73dQ/s72-c/DSCI0001.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4274962387820623145</id><published>2011-04-16T05:25:00.000-07:00</published><updated>2011-07-06T06:39:05.714-07:00</updated><title type='text'>ATtiny tip - solder the resonator on top</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-0yF7oqcVsM4/TamIGjuj6qI/AAAAAAAAFvk/OH4vow6VO0U/s1600/DSCI0002.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://1.bp.blogspot.com/-0yF7oqcVsM4/TamIGjuj6qI/AAAAAAAAFvk/OH4vow6VO0U/s400/DSCI0002.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You can only set the fuses for the 8MHz internal with 10% accuracy or for a crystal or resonator.  And if you set it to require a crystal, you can't use ISP without having one.&lt;br /&gt;&lt;br /&gt;You want to use a resonator for the higher accuracy for baud rates or such, but how do you program it using ISP?  You can attach a daugherboard with crystal or resonator, but having a crystal at the far end of wires isn't reliable.  &lt;br /&gt;&lt;br /&gt;The High voltage programming mode works for the ATtinyX5 series, but they are few wires, but the 2/4-313 is parallel with lots of wires.&lt;br /&gt;&lt;br /&gt;The usual resonators are on 0.1" wires.  What I do is push the middle ground pin to one side, and push the two resonator wires in so that they go diagonally across the top of the pins.  Then I take a wire from the center wire (now on the top) and run it to ground.&lt;br /&gt;&lt;br /&gt;Note: Some idiot named Vinod was spamming this post for some electronic services in Delhi, so I've closed comments for this one post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4274962387820623145?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4274962387820623145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4274962387820623145'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/attiny-tip-solder-resonator-on-top.html' title='ATtiny tip - solder the resonator on top'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-0yF7oqcVsM4/TamIGjuj6qI/AAAAAAAAFvk/OH4vow6VO0U/s72-c/DSCI0002.JPG' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6798574318067373125</id><published>2011-04-15T08:11:00.000-07:00</published><updated>2011-04-15T08:11:09.398-07:00</updated><title type='text'>ThingSpeak</title><content type='html'>There is a new service that puts devices on the web, Thingspeak.com.&lt;br /&gt;&lt;br /&gt;It includes slots for status and GPS style location and multiple sensor data.&lt;br /&gt;&lt;br /&gt;I'm going to put my harley on it.&lt;br /&gt;&lt;br /&gt;I already have Webgpsd going at github.com/tz1, and I was looking for something instead of or in addition to GPSGate which I did with minigpsd.  This should be easy.&lt;br /&gt;&lt;br /&gt;The only limit is 15 seconds between updates, but I can send RPM, gear, engine temp, fuel and other bits.&lt;br /&gt;&lt;br /&gt;I already have a new J1850 to UART (to bluetooth module) based on the ATtiny2313 - or go right into the Venus GPS and let it do the merge.  I need to do a bit of soldering, but it is ready,&lt;br /&gt;&lt;br /&gt;Then I need to add thinkgspeak.com to webgpsd and turn on harley decoding again.  I'll be busy this weekend.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6798574318067373125?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6798574318067373125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/thingspeak.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6798574318067373125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6798574318067373125'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/thingspeak.html' title='ThingSpeak'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-9208576521338856735</id><published>2011-04-13T19:26:00.000-07:00</published><updated>2011-04-13T19:26:48.833-07:00</updated><title type='text'>Venus SDK and EVB</title><content type='html'>I got the SDK that goes with the evaluation board for the Venus 638.  It lets me add to the firmware and make some changes to how it operates. &lt;a href="http://www.dl9sec.de/venus6/venus6.htm"&gt; Thanks to Thorsten for his code and notes.&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The downside:  The SDK will only do 10Hz, not 20.  Most of the peripherals aren't interrupt driven, so things like the UART in aren't really useful since you will lose characters.&lt;br /&gt;&lt;br /&gt;The upside:  There is a nice I2C core and an SPI core (they use for logging).  Most of the data is easily accessible.&lt;br /&gt;&lt;br /&gt;So I've been playing with the I2C (after not being able to get the UART to go fast).&lt;br /&gt;&lt;br /&gt;I managed to get a &lt;a href="http://www.newhavendisplay.com/index.php?main_page=product_info&amp;cPath=3_111&amp;products_id=2410"&gt;newhaven display unit&lt;/a&gt; showing the first part of the GPRMC message.&lt;br /&gt;&lt;br /&gt;I've also done a J1850-to-UART for the ATtiny2313, which I adapted by adding USI-TWI slave code, which also applies to the ATtiny85, but doesn't seem to work there, probably because it doesn't have a real input capture.  The UART version has a 10Mhz crystal since it divides close to 115200 for bluetooth, but the USI version can work without a crystal using the "close enough" 8 MHz internal oscillator setting.  If I wanted to get fancy, I could use the PPS or something else on the Venus to calibrate it, but it doesn't seem necessary.&lt;br /&gt;&lt;br /&gt;This isn't yet on my bike, but I have data being sent across J1850 appearing as NMEA-like messages on the serial output of the Venus.  I have to set the Venus to 10Hz to avoid missing anything, but after some tweaks it seems to be 100%, though I've Digikeyed a bunch of ATtiny4313s with twice the RAM.  The code should be up on Github or somewhere similar shortly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-9208576521338856735?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/9208576521338856735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/venus-sdk-and-evb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/9208576521338856735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/9208576521338856735'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/venus-sdk-and-evb.html' title='Venus SDK and EVB'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7927009649881744403</id><published>2011-04-02T11:07:00.000-07:00</published><updated>2011-04-07T13:08:12.257-07:00</updated><title type='text'>GLONASS+GPS on my satellite display</title><content type='html'>webgpsd uses an HTML5 canvas&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.zdez.org/Screenshot-2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="600" width="1024" src="http://www.zdez.org/Screenshot-2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I managed to bludgeon the code into doing GLONASS alongside GPS.  I might update the github repo with it but I really need to clean it up&lt;br /&gt;&lt;br /&gt;edit - the latest is always at https://github.com/tz1/webgpsd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7927009649881744403?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7927009649881744403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/glonassgps-on-my-satellite-display.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7927009649881744403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7927009649881744403'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/glonassgps-on-my-satellite-display.html' title='GLONASS+GPS on my satellite display'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7041740716344823628</id><published>2011-04-02T06:03:00.000-07:00</published><updated>2011-04-02T06:03:25.664-07:00</updated><title type='text'>(SkyTraq) Venus rising - A new and probably the best GPS/GNSS</title><content type='html'>I just got some eval boards from SkyTraq with their new GPS chips.&lt;br /&gt;&lt;br /&gt;The first one is the Venus 7 that does GLONASS in addition to GPS (it will do either depending on what is visible - it can do a 3d solution from 2 of each).  Limited to 1Hz but the DoP (dilution of precision) is better with the extra satellites.&lt;br /&gt;&lt;br /&gt;The second is their new 638 chip that I can customize the firmware (e.g. adding the j1850 directly to the output stream) and runs at &lt;b&gt;20Hz!&lt;/b&gt;  It does WAAS, though it seems to have trouble locking in on the satellite and the position reported is off (it should be at the equator which is south of where I am).  It also does AGPS so it finds satellites quickly.&lt;br /&gt;&lt;br /&gt;Both are surprisingly sensitive, getting good signal strength in many places.&lt;br /&gt;&lt;br /&gt;One downside is that NMEA was not designed for two satellite systems.  So I have to rip out and replace parts of my webgpsd to accommodate the dual sentence structure.  (It is annoying in that the satellites themselves are G+GSV with the + as either P or L for gPs or gLonass, but G+GSA will be P or L if only one is used, but be N if there are two and you have to look at the satellite numbers to tell which it refers to).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gpsd.berlios.de/"&gt;gpsd-ng&lt;/a&gt; is in worse shape, but I'm going to be working with the project to remove floating point as much as possible and redo the NMEA parser anyway, so this is a good time to do the change.&lt;br /&gt;&lt;br /&gt;The GLONASS version does not (yet?) do WAAS or AGPS, or would it be AGNS? &lt;br /&gt;&lt;br /&gt;I had both out yesterday.  Both worked well but I'm still processing the logged data.&lt;br /&gt;&lt;br /&gt;The 20Hz has one artifact.  Even at 10Hz the samples are far enough that it looks linear even though there is quantization going on.  At freeway speeds you move about 10 feet (3 meters) every 10th of a second.  This is about the accuracy of the gps, but is about 30 times the precision.  20Hz cuts that in half and is visible at lower speeds.  The position is quantized to fractions of seconds of about 16 centimeters, but webgpsd changes it to 10cm microdegrees.&lt;br /&gt;&lt;br /&gt;If you imagine a graph paper where you have to draw lines only from intersection to intersection, if the paper is fine or the lines are long it will look smooth.  If the lines are 20 units apart it will look smooth.  If 10, it will start to look jaggy.  If 5 it will look like an accordion.&lt;br /&gt;&lt;br /&gt;Only when you zoom in, and at the higher speeds 20Hz is so much better, but at slow speeds, and with the typical drift of a few counts either way as the satellites move and are recomputed, the quantization effect is that much worse.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7041740716344823628?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7041740716344823628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/skytraq-venus-rising-new-and-probably.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7041740716344823628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7041740716344823628'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2011/04/skytraq-venus-rising-new-and-probably.html' title='(SkyTraq) Venus rising - A new and probably the best GPS/GNSS'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5802075705640955987</id><published>2010-11-07T15:24:00.000-08:00</published><updated>2010-11-07T15:24:33.619-08:00</updated><title type='text'>Fedorable 14</title><content type='html'>I've been switching away from Ubuntu for Fedora and I find it is now far better.&lt;br /&gt;&lt;br /&gt;First, I'm upgrading from 13 to 14 and it isn't shoving all the junk I removed down my throat again and making strange and arbitrary changes to my setup.  I'm not sure what Malicious Meerkat has because I haven't looked at it but I would have expected them to backport fixes to the current version and that hasn't happened.  Another nice thing about the upgrade is you can interrupt it and it will restart (though it will update the update).  My boot partition is a bit small so it warns I will need a fixed ethernet connection (instead of the you need a wireless driver - I'll try to download it - oh, I can't because... deadlock in Ubuntu).  Everything has been available.&lt;br /&gt;&lt;br /&gt;Fedora still has the Gnome flaws that Ubuntu has, but they aren't making whimsical and arbitrary changes to it either instead of fixing the flaws.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5802075705640955987?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5802075705640955987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/11/fedorable-14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5802075705640955987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5802075705640955987'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/11/fedorable-14.html' title='Fedorable 14'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5198727692524584049</id><published>2010-10-27T17:23:00.000-07:00</published><updated>2010-10-27T17:23:02.618-07:00</updated><title type='text'>As the weather turns colder, resuming projects.</title><content type='html'>I've not been idle, but that means I've been riding more than anything else.&lt;br /&gt;&lt;br /&gt;But I have a few things in the works.&lt;br /&gt;&lt;br /&gt;First, I'm updating minigpsd to work as webapps instead of the earlier APIs, and use JSON instead of XML.&lt;br /&gt;&lt;br /&gt;For maps and weather, I have a work in progress &lt;a href="http://www.zdez.org/gmap.html"&gt;here&lt;/a&gt; which has a moveable google map with corresponding wunderground radar map scaled to be the same error (within a few percent - any tweaks to the algorithm are welcome).  The Javascript program and html are released under GPL.&lt;br /&gt;&lt;br /&gt;It works on an iPod touch, a desktop browser, Android browser...&lt;br /&gt;&lt;br /&gt;Minigpsd now does HTML5 canvas status images, but I don't think they will work in IE.  I tried SVG and it works, but the android browser doesn't support it (turned off!).&lt;br /&gt;&lt;br /&gt;All that is targeted at the new &lt;a href="http://wiki.ladyada.net/chumbyhackerboard"&gt;Chumby Hacker Board&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have Fedora 12 for ARM working in a chroot, which gives me bluetooth and avahi.  The former will read GPS and other sensors.  The latter makes attaching easy - create an AdHoc network and use auto-assigned IPs, then http://tz-hhack.local/ to access content.&lt;br /&gt;&lt;br /&gt;I've also been playing with bluetooth modules (mdfly.com has them for $10) attached to an ATtiny2313 - serial and ICP.  10Mhz gives 115.2kbaud, and it can read the Valentine V1 or J1850 and replay.  The J1850 is working now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5198727692524584049?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5198727692524584049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/10/as-weather-turns-colder-resuming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5198727692524584049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5198727692524584049'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/10/as-weather-turns-colder-resuming.html' title='As the weather turns colder, resuming projects.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7836523627134634074</id><published>2010-06-04T16:42:00.000-07:00</published><updated>2010-06-04T16:44:10.323-07:00</updated><title type='text'>Radar @ Harley</title><content type='html'>The following form is what I use on my Harley, though embedded in &lt;a href="http://github.com/tz1/minigpsd"&gt;minigpsd&lt;/a&gt; and adjusted for my Nokia's screen size&lt;p&gt;&lt;br /&gt;It returns with an animated gif looking 20 miles (from the radius) from the center to the side of the square.&lt;br /&gt;&lt;p&gt;To see your area, set the latitude and longitude.  Or check the national radar to find an active location.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;form action=http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_composite method=GET&gt;latitude &lt;input name=centerlat type=text value=35.6&gt; longitude &lt;input name=centerlon type=text value=-95.3&gt;&lt;br /&gt;&lt;br /&gt;radius &lt;input name=radius type=text value=20 size=5&gt;&lt;br /&gt;&lt;br /&gt;type &lt;input name=type type=text value=N0R size=3&gt;&lt;br /&gt;frame &lt;input name=frame type=text value=0 size=1&gt;&lt;br /&gt;number of images &lt;input name=num type=text value=5 size=2&gt;&lt;br /&gt;animation delay &lt;input name=delay type=text value=10 size=3&gt;&lt;br /&gt;&lt;br /&gt;width &lt;input name=width type=text value=400 size=4&gt;&lt;br /&gt;height &lt;input name=height type=text value=400 size=4&gt;&lt;br /&gt;&lt;br /&gt;newmaps&lt;input name=newmaps type=text value=1 size=1&gt;&lt;br /&gt;&lt;br /&gt;r&lt;input name=r type=text value=1159834180 size=12&gt;&lt;br /&gt;show storms&lt;input name=showstorms type=text value=0 size=1&gt;&lt;br /&gt;theme&lt;input name=theme type=text value=WUNIDS_severe size=24&gt;&lt;br /&gt;show snow&lt;input name=rainsnow type=text value=0 size=1&gt;&lt;br /&gt;&lt;br /&gt;&lt;input type=submit&gt;&lt;br /&gt;&lt;/form&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7836523627134634074?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7836523627134634074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/06/radar-harley.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7836523627134634074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7836523627134634074'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/06/radar-harley.html' title='Radar @ Harley'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8354052006313522542</id><published>2010-06-01T00:13:00.000-07:00</published><updated>2010-06-04T13:17:58.890-07:00</updated><title type='text'>Travel Logs - KMZ and time lapse video</title><content type='html'>&lt;div style="font-family: inherit;"&gt;These KMZs are processed - I didn't upload the ones with the raw data but I might after post-processing.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B5eDKBsl4bmFMDI1NTAwODYtYjM4Yy00NTM5LWE1NWYtYTQyNGFkODM5NWNm&amp;amp;hl=en"&gt;KMZ of my 10Hz GPS - 5/29 throu 5/31&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6/1 - my Nokia tablet had a problem&amp;nbsp; so didn't record a  KMZ&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B5eDKBsl4bmFOGQxODc5YjEtNmJkNS00ZWQzLThhYTktZWNiNzVhOWE1NGFi&amp;amp;hl=en"&gt;KMZ  for 6/2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B5eDKBsl4bmFMWYxMjNiY2YtZjU1NC00NjkwLWE5ZjQtOTY0ZDJkMDdiNGZl&amp;amp;hl=en"&gt;KMZ for 6/3, the end.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Time lapse - much of the sky instead of the road &lt;br /&gt;&lt;br /&gt;&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/p/AE1342ACF1A8AAA9&amp;amp;hl=en_US&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/p/AE1342ACF1A8AAA9&amp;amp;hl=en_US&amp;amp;fs=1" type="application/x-shockwave-flash" width="480" height="385" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8354052006313522542?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8354052006313522542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/06/travel-logs-kmz-and-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8354052006313522542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8354052006313522542'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/06/travel-logs-kmz-and-video.html' title='Travel Logs - KMZ and time lapse video'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2444320387312675907</id><published>2010-05-31T17:38:00.000-07:00</published><updated>2010-06-02T22:43:49.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='harley leak spot drip gasoline oil'/><title type='text'>When given a Limon in Colorado... My harley leaves its mark.</title><content type='html'>It is memorial day and the Harley dealerships are closed.  My service manuals are over 1000 miles distant, and after filling the fuel tank there was this huge spot.  It was the color oil but smelled like gasoline.&lt;br /&gt;&lt;br /&gt;Here is my dilemma, and why I'm sitting here writing this post instead of continuing on to Kansas.  If it is just gasoline overflow and the color was a false positive (my high-tech oil gage showed empty but it is cold/full), I could have continued.  If there IS a more serious problem, the engine would seize somewhere on I-70 and it would get worse from there.  So I'm sitting in a nice motel room typing this instead of riding.  Where I got on the internet and found &lt;a href="http://www.hdforums.com/forum/dyna-glide-models/225781-a-leak-or-what-im-stumped.html"&gt;more information&lt;/a&gt; as to what might be going on.  I have the extended warranty (service contract) and AAA trip protection and an extra day shouldn't hurt.&lt;br /&gt;&lt;br /&gt;I should mention I am enjoying the ride.  Really enjoying it.  This is why people ride.  Just the scenery.  And the bike.  And the wind.  (And the bugs which got painful in the last few minutes ...).  I also happen to have a bit of a sunburn, so it is probably the best thing to pause.  I used something which claimed to be water/sweat/sports proof SPF 30 which should be 100% blocking, but why am I so red?&lt;br /&gt;&lt;br /&gt;I am in the process of uploading to youtube.  And in the process of getting rid of Chrome.  I thought that it would work better to upload to Youtube in Chrome, and the only thing I get is the upload percent updated in the corner too.  But Google Reader and GMail and other web pages are broken or sticky.  Firefox has problems, but they tend to be predictable and although annoying don't do bad things.  My folder list was scrambled in Google Reader (it may have thought I dragged something...).  Other sites just sat there and spun.  While the URL pasted in firefox ran and completed (and I have about 50 extensions).  Google, you can do better - much better.  Firefox 4.0 should be both faster and actually work.&lt;br /&gt;&lt;br /&gt;The latter part of the timelapse of my journey 5/30/10 is of the sky but it should be up in a few hours (and I will post here).&lt;br /&gt;&lt;br /&gt;UPDATE - after calling the dealership the next day, although they recommended taking it in (84 miles in the wrong direction) because it was gasoline, it turns out that if you fill the tank with COLD gasoline and leave it in the heat, it will warm up and expand (I tried leaving the cap loose and it splashed a few drops when I tried to close it to a seal after warming up.&amp;nbsp; If you seal it before it will go out that tube just to the front on the left side of the rear tire.&amp;nbsp; When I get to my service manuals I plan on doing another update.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2444320387312675907?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2444320387312675907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/when-given-limon-in-colorado-my-harley.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2444320387312675907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2444320387312675907'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/when-given-limon-in-colorado-my-harley.html' title='When given a Limon in Colorado... My harley leaves its mark.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7229957310011288462</id><published>2010-05-31T07:11:00.000-07:00</published><updated>2010-05-31T07:11:52.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='google chrome bugs'/><title type='text'>Google Chrome is a stupid early alpha even if it is stable.</title><content type='html'>I was uploading the BIG HD timelapse file, and I accidentally selected the new post in that tab.  It didn't say "upload in progress do you really want to waste the last 30 minutes".  It just killed the upload and YouTube is too stupid to have any kind of resume (This is in FTP going back 25 years).&lt;br /&gt;&lt;br /&gt;Chrome (linux) also locked up on something - I couldn't get certain pages (but others worked).  They all had the links loaded, but presented the "something on this page is locking up" and killed the page completely to replace it with the crash page so I couldn't even click on a link that might have worked.&lt;br /&gt;&lt;br /&gt;If there is a page that the javascript crashes, the links aren't broken.  The javascript should be stopped, but display it as a static page.&lt;br /&gt;&lt;br /&gt;And be smarter about asking when something is busy.  I can't control to force everything to open a new tab (like I have on Firefox), and there aren't extensions yet so I'm stuck with their stupid design mistakes.  I will be going back to firefox.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7229957310011288462?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7229957310011288462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/google-chrome-is-stupid-early-alpha.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7229957310011288462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7229957310011288462'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/google-chrome-is-stupid-early-alpha.html' title='Google Chrome is a stupid early alpha even if it is stable.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3393850516090132030</id><published>2010-05-31T07:04:00.000-07:00</published><updated>2010-05-31T07:15:00.733-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motorcycle crosscountry weather radar harley'/><title type='text'>Transcontinental</title><content type='html'>I'm in the middle of my trip back to Michigan from San Diego.&lt;br /&gt;&lt;br /&gt;For the Sunday part, I have a HD time-lapse on my new Samsung HD http://www.amazon.com/gp/product/B002GYWJ3Y - it was on sale for $99 so I couldn't resist.  I will have pictures of the setup when I have some more time.&lt;br /&gt;&lt;br /&gt;I entered and became a finalist in the Arrow-Atmel Smart contest but didn't win, but the entry was my motorcycle system.  And there was a miscommunication so it was delayed so is being shipped back to Michigan.  I had to recreate it, so version 1.5 is on my bike at the moment and I will have an article on that.  I have KMZ files with all the relevant engine data of the journey so far.&lt;br /&gt;&lt;br /&gt;One feature that was handy yesterday was my live radar map.  It is in minigpsd (up at maemo.org in the diablo archive - I should move it to github).  It uses the GPS to create a local page with iframe with a map from the weather underground&lt;br /&gt;&lt;br /&gt;More updates later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3393850516090132030?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3393850516090132030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/transcontinental.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3393850516090132030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3393850516090132030'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/transcontinental.html' title='Transcontinental'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7128976452373879743</id><published>2010-05-12T08:11:00.000-07:00</published><updated>2010-05-12T08:11:25.029-07:00</updated><title type='text'>Anotehr good FAT library - sdfatlib</title><content type='html'>It drops into the arduino environment and provides FAT16 and FAT32 access to SD cards.  Adafruit has a new SD Shield (sadly, it lacks an SRAM for a buffer, but does have an RTC).&lt;br /&gt;&lt;br /&gt;http://code.google.com/p/sdfatlib/&lt;br /&gt;&lt;br /&gt;It is C++, in two monolithic sections, one for the SD and one for the FATFS but the author did a very good job of coding it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7128976452373879743?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7128976452373879743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/anotehr-good-fat-library-sdfatlib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7128976452373879743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7128976452373879743'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/anotehr-good-fat-library-sdfatlib.html' title='Anotehr good FAT library - sdfatlib'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2316373519130616493</id><published>2010-05-11T21:44:00.000-07:00</published><updated>2010-05-11T21:51:28.762-07:00</updated><title type='text'>New Kent Display</title><content type='html'>&lt;table style="width:auto;"&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://picasaweb.google.com/lh/photo/P6c7TlUuWx6dt7tI2lPlyg?feat=embedwebsite"&gt;&lt;img src="http://lh4.ggpht.com/_F0DRJg2NK8o/S-oxXQakxlI/AAAAAAAABbs/mCDqsbpX_LA/s144/100_0599.JPG" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family:arial,sans-serif; font-size:11px; text-align:right"&gt;From &lt;a href="http://picasaweb.google.com/tz2026/Public?feat=embedwebsite"&gt;Public&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;This is the new display combined with my QR encoding library, all at http://github.com/tz in the sparkfun repo, in the qrkentlcd subdirectory.&lt;br /&gt;&lt;br /&gt;The display holds the image with the power off.  This is 4x (one QR square = 4x4 pixels).&lt;br /&gt;&lt;br /&gt;It uses SPI, 1 is white, 0 is dark blue.&lt;br /&gt;&lt;br /&gt;One big downside is that it is SLOW.  It takes over a second to update the display.  It isn't going to do fast animations (or rpm updates from my harley :(, it doesn't have adequate sub-screen update).  But for things like this - persistent and high-resolution, high contrast, sunlight readable, it works very well.&lt;br /&gt;&lt;br /&gt;It is also a bit pricey.&lt;br /&gt;&lt;br /&gt;http://www.sparkfun.com/commerce/product_info.php?products_id=9559&lt;br /&gt;&lt;br /&gt;with the breakout:&lt;br /&gt;&lt;br /&gt;http://www.sparkfun.com/commerce/product_info.php?products_id=9747&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2316373519130616493?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2316373519130616493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/new-kent-display.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2316373519130616493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2316373519130616493'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/05/new-kent-display.html' title='New Kent Display'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_F0DRJg2NK8o/S-oxXQakxlI/AAAAAAAABbs/mCDqsbpX_LA/s72-c/100_0599.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-680961245990333284</id><published>2010-04-15T07:13:00.000-07:00</published><updated>2010-04-15T07:20:50.718-07:00</updated><title type='text'>Luciferic Lynx</title><content type='html'>Ubuntu doesn't change.&lt;br /&gt;&lt;br /&gt;Network Manager is still broken, missing the AP which has been on for 5 minutes but listing every AP I drove by.  I suppose it would be good for war-driving, just not for managing wireless.&lt;br /&gt;&lt;br /&gt;The Upgrade manager still doesn't work right (and will even put all the junk back I took out - moving to Xubuntu helps since it doesn't insist on evolution or mono).&lt;br /&gt;&lt;br /&gt;Notify-osd is still broken.  I.e. there is no way to configure it to be un-annoying, nor dismiss the boxes.&lt;br /&gt;&lt;br /&gt;Grub-2 is still horribly broken.  It finds anything which might be bootable and adds it to the menu EXCEPT DOS still.&lt;br /&gt;&lt;br /&gt;Here is a DOS tip (following up on my Kursed Karmic post).&lt;br /&gt;&lt;br /&gt;Part of my delay posting is my HP netbook - which I like - had some go arounds with HP repair.  They were good about it but it took some back and forth until every part functioned properly.  They were good enough about it I'm seriously thinking of their tablet instead of the iPadLockIn.&lt;br /&gt;&lt;br /&gt;This time they reinstalled Windows, but it was in a better state than I could have restored it to, so instead of restoring my image, I cleaned up XP and shrank the partition, and moved XP up about 1G for a DOS partition.  The version of DOS I use for my recovery master USB drive doesn't like booting too far out on the disk.  With nothing else, XP worked fine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-680961245990333284?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/680961245990333284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/04/luciferic-lynx.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/680961245990333284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/680961245990333284'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/04/luciferic-lynx.html' title='Luciferic Lynx'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6975521376204400755</id><published>2010-03-29T09:09:00.000-07:00</published><updated>2010-03-29T09:09:01.500-07:00</updated><title type='text'>Busy with, among other things Busies.</title><content type='html'>I have many updates to Hyperlog/Fat32cli and have been on github with comments and such under OpenLog trying to solve the problem of dropped sectors (at high baud rates).&lt;br /&gt;&lt;br /&gt;First, I've found a lot of interesting and a few strange things about erasing SD cards.  I already mentioned (in the Flashdance post earlier) that SD cards slow down according to performance curves in the spec.  Erasing a card turns out to be simple, so I've added an erase routine to the SD driver and a fat32format routine to fat32lib (just over 1k, but not included if not used).  And a # command to fat32cli.  Erase can take several minutes.  Once erased, the dropped sectors should all but disappear until the card's internal flash is fragmented.  One possible exception - I am rewriting the FAT and directory entry, but it should be able to shift fairly quickly since it doesn't have to shuffle and re-erase a block.&lt;br /&gt;&lt;br /&gt;Second, I've added a 32K SPI SRAM which has enough space to buffer characters at very high baud rates, and added sramlog with the initial version.&lt;br /&gt;&lt;br /&gt;While doing this, I found at least one of my cards with a class 6 label reports as class 2 in a program I was using investigating the erase process (They have a way to do so in blocks so you can track progress and cancel v.s. the whole card).  Others report correctly.  I note this because I can't find ANY utility that does this under any OS on the web after a fairly long attempt with google.  So I can't confirm it but am suspicious after Bunnie found lots of fake cards http://www.bunniestudios.com/blog/?p=918 so maybe the next step is to write a utility printing this info out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6975521376204400755?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6975521376204400755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/busy-with-among-other-things-busies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6975521376204400755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6975521376204400755'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/busy-with-among-other-things-busies.html' title='Busy with, among other things Busies.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7182213046698203837</id><published>2010-03-07T14:21:00.000-08:00</published><updated>2010-03-08T08:14:00.517-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QRcode image processing'/><title type='text'>In java, Not half bad.</title><content type='html'>Updated.&lt;br /&gt;&lt;br /&gt;Over at github.  &lt;a href="http://github.com/tz1/qrduino/blob/master/imageproc/QuickFinderFinder.java"&gt;A command line finder finder&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Run through javac to create the class(es).&lt;br /&gt;&lt;br /&gt;java QuickFinderFinder &lt;i&gt;imagefile&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The C version and this are now in sync and seem to work well.  There are still some optimizations possible, but I don't know how effective they would be.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7182213046698203837?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7182213046698203837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/in-java-badly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7182213046698203837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7182213046698203837'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/in-java-badly.html' title='In java, Not half bad.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7740963188399283826</id><published>2010-03-05T22:58:00.000-08:00</published><updated>2010-03-06T16:10:01.044-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QRcode image processing'/><title type='text'>Very fast constrained QR finder finder - Feature Complete</title><content type='html'>&lt;b&gt;quickie.c&lt;/b&gt; at github.  http://github.com/tz1/qrduino in the imageproc directory&lt;br /&gt;&lt;br /&gt;Feature complete, but I need to clean things up.  Limited memory usage.  Very fast, and except for the initial check, has a linear runtime (i.e. based on the width or height, not area).&lt;br /&gt;&lt;br /&gt;Completely accurate and surprisingly effective even if the constraints are bent.&lt;br /&gt;&lt;br /&gt;It finds 50% of the test images in the zxing set, with one false on a 45 degree rotated image (way out of the constraints).&lt;br /&gt;&lt;br /&gt;There are a handful it fails on which it might otherwise work on an actual camera but have some subtle but serious distortions due to the image sampling, e.g. the 11311 ends up as 1 3 6 3 2 or 2 2 4 2 2- the outer box is too thin or such as the edges are just at the wrong camera pixel boundary.  One gray&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Constraints&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;One finder pattern needs to be close to the upper left corner of the image.  It need not be exact but there is a chance that the noise in the white background might be mistaken for a finder.&lt;br /&gt;&lt;br /&gt;The finder patterns must be vertically and horizontally aligned within a few pixels, i.e. drawing a line vertically or horizontally from the center of one finder must intersect the center 3x3 of the other.  It need not be perfectly flat but perspective distortion will cause this to be violated, especially for large codes.&lt;br /&gt;&lt;br /&gt;Update: I have a "try harder" so the 3x3s need to overlap, not just the center.&lt;br /&gt;&lt;br /&gt;The finder patterns need to be undamaged and have sufficient contrast.&lt;br /&gt;&lt;br /&gt;Module size should be at least 3 pixels - 2/4 eroded, but 3 average.&lt;br /&gt;&lt;br /&gt;It doesn't require the finders be below and to the right - it will interpolate the third from the second.&lt;br /&gt;&lt;br /&gt;This is easily done with a cell phone camera, though preferably with a box and guide lines so the image can be aligned and be within the scan area.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Method:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Start 17 pixels (module size) down from the top and start tracing diagonal lines up and to the right across the gray field (no, it doesn't have to be histogram-ed or thresholded into black and white).  Find the average luminosity of the line and use it as a threshold.  Reduce the crosses of the average to run-lengths.  Process the run-lengths to find a 11311 pattern, e.g. 20,[4,5,11,4,4]...  This will be diagonally across the corner finder pattern.  Do a plus sign to find the extents (using the same average for a threshold), then find the center of the 3x3 box, and record the size.&lt;br /&gt;&lt;br /&gt;Going vertically, start from just below the original finder, and use an adapted average based on the average at the ULF (upper left finder).  Look for the same 11311 pattern, and do the same width-height calculation.  Throw away sizes very different from the ULF.  There may not be a finder pattern if the code is rotated clockwise, or there may be a fake one, so just store it for now.&lt;br /&gt;&lt;br /&gt;Do another search, but horizontally to the right from the ULF.&lt;br /&gt;&lt;br /&gt;(if the code image wasn't rotated, you probably have the three now, but you still might have to evaluate as there may already be some false positives).&lt;br /&gt;&lt;br /&gt;From the center of each potential finder found vertically, search to the right horizontally.&lt;br /&gt;&lt;br /&gt;From the center of each potential finder found horizontally, search downward vertically.&lt;br /&gt;&lt;br /&gt;You now have the complete set of finders and know the module size.  Some might be duplicates so sort them and pick the three based on size (close to the original), distance (square if you don't want to allow rectangular pixels) and right angle.&lt;br /&gt;&lt;br /&gt;I'm adjusting the sorting criteria now - it is possible that every false positive could be eliminated in the runs scan.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I don't require thresholding the image before hand.&lt;br /&gt;&lt;br /&gt;I only examine a tiny fraction of the pixels in the image.  (2 scans per diagonal initially, but those are short, and then one each vertical and horizontal, then one per pattern found in the v and h scans).  I don't do any complex mathematics - only maintaining the dynamic threshold and evaluating if the current pixel is above or below - and I don't even store a line, only a list of run-lengths.&lt;br /&gt;&lt;br /&gt;Test pic qrcode-4/09.jpg finds 3 wrong patterns, but the image is at 45 degrees, way out of alignment.&lt;br /&gt;&lt;br /&gt;No false positives get through.&lt;br /&gt;&lt;br /&gt;(After finding it, you can then run it through the thresholding if desired - but you would only need to do the part of the image containing the code modules, and you have the finder positions and module sizes, so can start looking for alignment patterns or version bits).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7740963188399283826?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7740963188399283826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/very-fast-constrained-qr-finder-finder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7740963188399283826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7740963188399283826'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/very-fast-constrained-qr-finder-finder.html' title='Very fast constrained QR finder finder - Feature Complete'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4191152044495739326</id><published>2010-03-04T21:16:00.000-08:00</published><updated>2010-03-04T21:28:26.193-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qrcode image processing finder histogram'/><title type='text'>QR code image processing - part 2</title><content type='html'>&lt;a href="http://github.com/tz1/qrduino/tree/master/imageproc/"&gt;Image Processing code here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I went through the zxing examples and code.&lt;br /&gt;&lt;br /&gt;The zxing methods aren't the most effective.  It uses a simple threshold which fails badly on many images where the lighting is not uniform, e.g. where a white pixel in the lower right has less luminance than a black one in the upper left.  It uses a static histogram.&lt;br /&gt;&lt;br /&gt;What I came up with is a dynamic line-by-line histogram window of 64 pixels, applied horizontally and then anded vertically, i.e a pixel must be "black" in both directions to be considered black in the output.&lt;br /&gt;&lt;br /&gt;Note it doesn't produce good results for anything other than barcode - a 64x64 square would probably work better.  However when there are clear distinctions between white and black in the window, it produces a result where the next steps can easily find the finder patterns.&lt;br /&gt;&lt;br /&gt;There are a few problematic images in the set they use to test- but they violate the spec.  They are those that seem to be a white overlay over some other kind of picture, so white is white, but black is anything from 0 to 80% of white.&lt;br /&gt;&lt;br /&gt;Stepping back a moment - I want to be able to find QR codes anywhere in the image, and to try for fairly severe angles.  If I could constrain it to a rectangle where I know the borders around the QR code are completely white, or it is perfectly cropped so the finders align with the picture edges - all nearly vertical or horizontal it would be easy and I could take a completely different approach which would handle a lot of these cases since I would already know how to set parameters up. For all the variation, there can only be two ultimate values, black and white, and they are supposed to be finder patterns at the corners.&lt;br /&gt;&lt;br /&gt;But for the photographs, I need to be more flexible.  I end up with noise and the QR image with the black pixels eroded.  Note that the zxing algorithm erodes black squares in bright areas and dilates them in dark ones.&lt;br /&gt;&lt;br /&gt;So hist.c reads in a PGM (ascii, no comments like the GIMP adds) and applies the line histogram windows and outputs a PBM (stdin to stdout).&lt;br /&gt;&lt;br /&gt;Now the problem is to find the finders.  They are 1-1-3-1-1 patterns, which are easy to find.  Here (finder.c) I do horizontal, then vertical, anding the result.  There needs to be some window for the pixel sizes so I do approximations - the white spaces and outer black should be equal, and the inner black should be about the sum of two blacks and a white.  Note this will still find the patterns at 45 degrees off, but will find the middle square in the diamond after the and operation.  With the noise it often has gaps, which I will explain how I'm fixing shortly.  To find the 11311, I first create an array of run lengths starting with white as 0, then check at the odd numbers. i and i+4 should be about the same, i+1 and i+3 should be too, and i+2 should be the "3".&lt;br /&gt;&lt;br /&gt;The sensitivity seems about right now, but I might have to adjust the calibration to compensate better for the erosion of black if I test more cases.  10 eroded 2 becomes 8 (x3=24), with the gaps becoming 12. and the "3", 30 becomes 28.&lt;br /&gt;&lt;br /&gt;Note that the finder 11311 ratio pattern has a high negative in the encode weighting, but still can occur within the main body of the QR code, though it would be very unlikely a real finder pattern would occur.&lt;br /&gt;&lt;br /&gt;Version 1.4 of the zxing finder finder code has problems.  Many of my perfect jpegs generated by qrduino FAIL.  First, it will end early if it finds three likely candidates that have the ratio in both the vertical and horizontal in one row/column, even if they look like plus signs and not squares, aren't at good angles, or anything else.  Second, even when it scans the whole image, it selects the first three blobs, and makes no attempt to insure they might be the right size, angles, or anything else.  I changed the code to scan the entire image, then pick the largest three candidates and it found all my qrduino images and more of the test images.&lt;br /&gt;&lt;br /&gt;My code should also work on rectangular images like the LCD below.  The zxing requires the vertical and horizontal sizes be similar.&lt;br /&gt;&lt;br /&gt;In most images there are three big squares whose center is the center of the finder pattern.  When the ratio looks wrong, it causes only one corner or some lines of the finder to be recognized.  So I added to my code (and still needs adjustment) orthogonal dilation.  If there is a found block in a 11311, and on the right are black pixels, it will widen the block 1 pixel.  And will repeat until the edge is not completely made of black pixels.  That is left to right.  Repeat top to bottom, right to left, and bottom to top.  All the finders are found, but there are other blocks on the screen but few are square, and most have black pixels bordering a significant part (unlike the white in the real finders).&lt;br /&gt;&lt;br /&gt;I'm outputting a PGM showing the candidates.  Some earlier test code would place 3 dots in the real finders, mostly at the center in almost all the test cases using the zxing black and white routines.  The next step is to throw out bad aspect ratio images, and see if any hard cases remain, then finish off to see if I can consistently pick out the centers of the 3 finders.&lt;br /&gt;&lt;br /&gt;Once I have the 3 finders, I can then use the knowledge of where things should be to go back to the original image, or to make things easier even in the processed version.  I have a box around the image.&lt;br /&gt;&lt;br /&gt;I haven't done a FFT yet, but actually the Goetzel algorithm should be better for the module size.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4191152044495739326?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4191152044495739326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/qr-code-image-processing-part-2.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4191152044495739326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4191152044495739326'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/03/qr-code-image-processing-part-2.html' title='QR code image processing - part 2'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-465123261221977289</id><published>2010-02-27T21:03:00.000-08:00</published><updated>2010-02-28T08:49:32.744-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QRcode image processing'/><title type='text'>QR Image processing made easy?</title><content type='html'>One of the difficulties in scanning a QR code is determining the size of the "modules" - the black or white blocks.&lt;br /&gt;&lt;br /&gt;QR codes try hard to avoid runs of one color, and to have 50% so each line will look a lot like a square wave at some frequency, with peaks at f (strongest), f/2, f/3, etc.  The period corresponding to this frequency will twice the size of a module.&lt;br /&gt;&lt;br /&gt;I can easily get this number, or a very small set of candidates, and even separate horizontal/vertical values for rectangular distortion using two common utilities: netpbm and audacity.  Yes, the audio processor.&lt;br /&gt;&lt;br /&gt;First, use netpbm to convert the image into a .PGM file, portable gray map.  Gimp will also work for this, (and despeckle and a slight blur will remove artifacts in the later step, but it is optionas).  It will have some header lines (which can but need not be discarded), then import this pgm file into audacity as unsigned 8 bit mono data at 100000 Hz (this number makes it easier).  Then run Analyze -&gt; Plot Spectrum and select Enhanced Autocorrelate.  Use a buffer about the horizontal size of the image (e.g. if the picture is 1200 wide, use 1024).  If you use this or the frequency spectrum (use logarithmic display) you will see a peak around the size of 2 modules.  The BWBWBW pattern produces a frequency component of twice the module width.&lt;br /&gt;&lt;br /&gt;Rotate it 90 degrees for height instead of width, or if it is supposed to be square, append the rotated version to the original.  Netpbm can do this too.&lt;br /&gt;&lt;br /&gt;There will be few peaks.  In the case of a picture of an LCD, the only significant peaks were at .00070 seconds, 70 samples.  And the modules were about 35 pixels wide in the image.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-465123261221977289?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/465123261221977289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qr-image-processing-made-easy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/465123261221977289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/465123261221977289'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qr-image-processing-made-easy.html' title='QR Image processing made easy?'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6920385374117042196</id><published>2010-02-26T16:33:00.000-08:00</published><updated>2010-02-26T18:41:36.857-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qrcode arduino embedded tutorial'/><title type='text'>QRduino - First Release</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://github.com/tz1/qrduino"&gt;http://github.com/tz1/qrduino&lt;/a&gt; has been active for a while. So here is the first release version, under the GNU General Public license, Version 3.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;It now is faster, with both generate a fixed version table and parameters in to a C file (pick the ecc level and size - no longer hard coded, mainly for AVR/embedded) and an on the fly version with mallocs (for the rest). Note I don't free the memory since I'm doing a CLI which expects to exit - the fix is for the next version.&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor=#FFFFFF border=1 width=480 height=480&gt;&lt;td valign=center align=center&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_F0DRJg2NK8o/S4iDqN-bZdI/AAAAAAAABWA/wa6eSY0kU8s/s320/IDontUse.jpg" /&gt; &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;I don't use any modulo or divides in the encoder anywhere so it is even faster now.  And there were other optimizations.  The mask array was symmetrical (mirror down the diagonal) so I stored it as a triangle.  I'm playing some games with buffer reuse so it doesn't have to regenerate the frame for masking, but it doesn't use much more space.&lt;br /&gt;&lt;br /&gt;For the embedded, all fixed data tables are in flash.  Minimal (8 bytes, but const) data segment usage for the AVR version of the encoder with tables or dynamic generation.  Optimized BSS usage.&lt;br /&gt;&lt;br /&gt;I will be adding to this post later with some examples.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6920385374117042196?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6920385374117042196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qrduino-first-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6920385374117042196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6920385374117042196'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qrduino-first-release.html' title='QRduino - First Release'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_F0DRJg2NK8o/S4iDqN-bZdI/AAAAAAAABWA/wa6eSY0kU8s/s72-c/IDontUse.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4824092184639487127</id><published>2010-02-23T22:15:00.000-08:00</published><updated>2010-02-23T22:19:57.792-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qrcode display newhaven'/><title type='text'>Newhaven Display + QRduino = much better</title><content type='html'>The focus wasn't perfect when I took the picture, but it worked on my Cliq:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh5.ggpht.com/_F0DRJg2NK8o/S4TBlX7X0VI/AAAAAAAABRk/PeWxTFOaA78/s576/100_0561.JPG" style="height: 576px; width: 432px;" /&gt;&lt;br /&gt;&lt;br /&gt;This is in more normal light:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh4.ggpht.com/_F0DRJg2NK8o/S4TA6NwXgDI/AAAAAAAABP4/TAUw7RWaUhA/s576/100B0560.JPG" style="height: 576px; width: 432px;" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4824092184639487127?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4824092184639487127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/newhaven-display-qrduino-much-better.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4824092184639487127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4824092184639487127'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/newhaven-display-qrduino-much-better.html' title='Newhaven Display + QRduino = much better'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_F0DRJg2NK8o/S4TBlX7X0VI/AAAAAAAABRk/PeWxTFOaA78/s72-c/100_0561.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3945426643169458973</id><published>2010-02-23T14:36:00.000-08:00</published><updated>2010-02-23T14:36:06.193-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netpbm graphic formats conversion scripting'/><title type='text'>Toolbox: NetPbm</title><content type='html'>NetPbm is a set of utilities that use a very simple bitmap format that allow for easy scripting and manipulation of images.&amp;nbsp; First, pnmtoplainpnm will output the data in ASCII where it is easy to edit or otherwise process with text utilities.&amp;nbsp; But there is pnmarith that lets me do a -difference to compare two bitmaps (how close are my qrcode images?&amp;nbsp; this shows it easily).&lt;br /&gt;&lt;br /&gt;You can also do simple operations like pad and scale, or convert to or from other formats easily.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3945426643169458973?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3945426643169458973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/toolbox-netpbm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3945426643169458973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3945426643169458973'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/toolbox-netpbm.html' title='Toolbox: NetPbm'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3458250810048695890</id><published>2010-02-23T14:08:00.000-08:00</published><updated>2010-02-23T14:59:30.800-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qrcode arduino embedded'/><title type='text'>QveRsized.</title><content type='html'>GitHub has the current revision, but it doesn't match the other implementation perfectly, and above a certain size, I can't test it with my camera, e.g.:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_F0DRJg2NK8o/S4RQzmbRW9I/AAAAAAAABPE/fTPkAEZMX6U/s1600-h/hello.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_F0DRJg2NK8o/S4RQzmbRW9I/AAAAAAAABPE/fTPkAEZMX6U/s320/hello.jpg" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This is version 40 - the largest possible, 177x177.&amp;nbsp; It would probably take an arduino mega, and then I would need a display - and something to read it.&amp;nbsp; But as a benchmark, the lcd compiles to:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;avr-size lcd.elf&lt;/div&gt;&amp;nbsp;&amp;nbsp; text&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; data&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; bss&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dec&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; hex&amp;nbsp;&amp;nbsp;&amp;nbsp; filename&lt;br /&gt;&amp;nbsp; 13502&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 7961&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 21563&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 543b&amp;nbsp;&amp;nbsp;&amp;nbsp; lcd.elf&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The frame generator is separate, but probably wouldn't use any more RAM, only flash.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3458250810048695890?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3458250810048695890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qversized.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3458250810048695890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3458250810048695890'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qversized.html' title='QveRsized.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_F0DRJg2NK8o/S4RQzmbRW9I/AAAAAAAABPE/fTPkAEZMX6U/s72-c/hello.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5236317958887193206</id><published>2010-02-21T22:02:00.000-08:00</published><updated>2010-02-24T19:32:15.430-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qrcode arduino embedded tutorial'/><title type='text'>QRduino</title><content type='html'>&lt;b&gt;QR codes for embedded systems:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://lh5.ggpht.com/_F0DRJg2NK8o/S4IVc3rXLyI/AAAAAAAABOw/oCyQ6MzTIhc/s1600/100_0543.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_F0DRJg2NK8o/S4IVc3rXLyI/AAAAAAAABOw/oCyQ6MzTIhc/s320/100_0543.JPG" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;Which takes about a second to generate on the Arudino.&lt;br /&gt;$ size lcd.elf&lt;br /&gt;&amp;nbsp;&amp;nbsp; text&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; data&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; bss&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dec&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; hex&amp;nbsp;&amp;nbsp;&amp;nbsp; filename&lt;br /&gt;&amp;nbsp;&amp;nbsp; 3676&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1895&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 5601&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 15e1&amp;nbsp;&amp;nbsp;&amp;nbsp; lcd.elf&lt;br /&gt;It fits in a 328, and I'm still working on the bss usage which is mostly the 1641 for the frame, and 172 for the input bitstring.&lt;br /&gt;&lt;br /&gt;Unfortunately, my Cliq won't read it nor will zxing.  Probably the distortion since the pixels aren't square.&amp;nbsp; This is a jpeg (and check github in the sparkfun wiki for information on embedding twotone jpegs):&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_F0DRJg2NK8o/S4Ib6mZ-c1I/AAAAAAAABOQ/eGSddnF-Y7M/s1600-h/hw.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_F0DRJg2NK8o/S4Ib6mZ-c1I/AAAAAAAABOQ/eGSddnF-Y7M/s320/hw.jpg" style="cursor: move;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;QR codes are two dimensional bar codes.&lt;br /&gt;Those are the boxes you see in place of URLs - because they are URLs,&lt;br /&gt;just encoded&lt;br /&gt;&lt;br /&gt;But first a few links to resources&lt;br /&gt;&lt;br /&gt;A C based qrcode program is available at:&lt;br /&gt;&lt;a href="http://pyqrcode.sourceforge.net/"&gt;http://pyqrcode.sourceforge.net/&lt;/a&gt;&lt;br /&gt;It uses a python wrapper, but produces PNG files&lt;br /&gt;&lt;br /&gt;This was something I could use to test my version - I modified it to produce a PBM file (ASCII text 1s and 0s), as well as checking if what I was calculating was right by dumping some of the internal structures.&amp;nbsp; This forced me to copy some of the quirks (they have some bits as flags or whatever so when I dumped their frame, it was either write something to post-process or duplicate the quirks; They also do something strange in the demerit code which I had to duplicate to get the same numbers, and had one ugly recursion in the data fill).&amp;nbsp; After I have something working, I can test N v.s. N-1 to see if anything changed, but how do I get N=0?&amp;nbsp; This was the easiest to use to get a known good version.&lt;br /&gt;&lt;br /&gt;Java based, android code, and online:&lt;br /&gt;&lt;a href="http://code.google.com/p/zxing/"&gt;http://code.google.com/p/zxing/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The wikipedia article covers most of the details:&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/QR_Code"&gt;http://en.wikipedia.org/wiki/QR_Code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A word about words.&amp;nbsp; The ISO spec and most websites use different terms which can be confusing.&amp;nbsp; "Version" is size.&amp;nbsp; Version 1 is 21x21, version 6 is 41x41, and they go up by 4 each version up to 171x171.  They call the black or white blocks "modules" instead of dots, blocks, or pixels.&lt;br /&gt;&lt;br /&gt;QR codes have a lot of options to cover a large number of use cases.&lt;br /&gt;&lt;br /&gt;I'll go through them and note why I chose to do things a certain way.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Data to Coded Bitstream&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The first step is to turn the letters, numbers, etc. into a string of bits.&amp;nbsp; Here there are a number of optons.&amp;nbsp; There is a tightly packed code for numbers, another for alphanumerics (44 symbols including uppoercase letters and numbers, and common symbols used in URLs).  Then there is a byte coding, and finally Kanji.&amp;nbsp; They can also be mixed, so if you have a URL that has a long set of letters for a directory with a file with a long string of numbers, the first part can be coded in 8-bit, then switch to alphanumeric, then switch to numeric, and maybe back and forth.&amp;nbsp; This way you can pack far more symbols.&lt;br /&gt;&lt;br /&gt;Note that it is NOT REQUIRED to use more efficient methods.&amp;nbsp; The downside of the numeric and alphanumeric coding is that you must operate at the variable bit level and pack strings of bits.&lt;br /&gt;&lt;br /&gt;For my implementation, I just use 8-bit.&amp;nbsp; This only requires shifting things three nybbles (3 times 4 bits) to the right for the prefix type code and a byte for length (for this implemetation - it can be two bytes).&amp;nbsp; At the end a zero nybble is appended.&amp;nbsp; To encode "HI", it would be hex 48 49 becomeing 00248490.&amp;nbsp; The code is short and compact.&lt;br /&gt;&lt;br /&gt;After the 0, which is an end marker, if there is space a set of alternating bytes is used as a fill pattern for the data space, so there will always be something in the buffer, and it allows me to specify a larger size even if I don't use all the space.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Error Correcton&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;QR codes use Reed Solomon error correction.&amp;nbsp; The mathematics are well known, but QR Codes offers 4 levels.&amp;nbsp; A particular size can only hold a fixed number of bytes.&amp;nbsp; In the case of version 6, it is 172, so if you have more error correction codes, you have less space for data.&lt;br /&gt;&lt;br /&gt;There are four levels, lwo, medium, quality, and high.&amp;nbsp; I'm using low since the images will be digital.&amp;nbsp; If this was for a thermal printer I would choose one of the top two.&amp;nbsp; The low level can lose 7% of the bits and still recover.&lt;br /&gt;&lt;br /&gt;The next step depends on the size, and for V6, L ecc, the data is split into 2 blocks and the correction is added to each block separately.&amp;nbsp; So 172 bytes holds 136 data + 36 ECC, but that is split up into the first half, 68 data, then 18 ecc, then another 68 and 18.&lt;br /&gt;&lt;br /&gt;Larger codes are split into more blocks, 4 is typical, smaller ones are just one block.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Frame and the Data.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There are fixed sections of the QR code image which the data has to wrap around, and the data bits zig-zag from the right corner left, then right and up, then left, and around these fixed areas.  &lt;br /&gt;&lt;br /&gt;Also if there are multiple blocks, it uses the first byte from each block, then the second from each block, and so on.&lt;br /&gt;&lt;br /&gt;This is as complicated to code as it sounds.&lt;br /&gt;&lt;br /&gt;The fixed areas include the large squares in the three corners, and the small target-like alignment squares (above v1) in the other corner, and added in the middle as the image gets larger.&amp;nbsp; There are also one row and column of alternating black and white blocks.&lt;br /&gt;&lt;br /&gt;Backing up a moment, one reason I chose to use 41x41 version 6 instead of version 7 is there is a "version" data block which has its own coding scheme and ecc and rules.&amp;nbsp; This creates a bit of a stup in the complexity since you need to implement functions for these blocks for anything v7 or larger.&amp;nbsp; 6 was a nice size and largest without this.&lt;br /&gt;&lt;br /&gt;There can be more pixels than data, and these are set to zero (black) initially.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Masking&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The problem is that most data isn't a nice 50% black/white noise pattern that would have clear edges in each row and column and no blobs of black or white.&amp;nbsp; So for the areas which are not fixed, a mask is applied.&amp;nbsp; The most basic one is a checkerboard (flip every alternate bit).&amp;nbsp; But there are vertical ro horizontal stripes and more complex patterns.&lt;br /&gt;&lt;br /&gt;There are 8 masking patterns in all and each is supposed to be tried and a weighted functions identify bad combinations.&amp;nbsp; A large amount more of one pixel color is one.&amp;nbsp; Series of pixels that look like the locating squares are very bad.&amp;nbsp; Long runs or large blocks of black or white are bad.&amp;nbsp; A weighted sum is produced for each masking pattern and the best chosen.&lt;br /&gt;&lt;br /&gt;Here is a place I cheat.&amp;nbsp; I printed out a sampling, and found a threshold number I use to say "good enough"&amp;nbsp; The numbers are just under 2000, and usually there would be one or two under 1800.&lt;br /&gt;&lt;br /&gt;There are two reasons not to try all 8.&amp;nbsp; First, to save memory I don't want to use a separate buffer, so I end up drawing the unmasked image each time.&amp;nbsp; If mask 3 is the best, it has to be redone after the later ones are tried, but if the mumber is low we can jsut use it "now".  The second reason is that the masking algorithms become more complicated (read slower) - they have modulo 3 divisions and more operators so mask 7-8 may take 10x the effort as mask 1.&amp;nbsp; So if mask 1 is "good enough", i.e. has a low score, I just use it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Finishing up&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The final step is to write some format information indicating which mask is used, and it wraps around the edges of the big alignment markers.&amp;nbsp; But that is the last step - the QR code is complete.&lt;br /&gt;&lt;br /&gt;The code will be at github.com when I finish a bit of packaging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5236317958887193206?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5236317958887193206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qrduino.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5236317958887193206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5236317958887193206'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/qrduino.html' title='QRduino'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_F0DRJg2NK8o/S4IVc3rXLyI/AAAAAAAABOw/oCyQ6MzTIhc/s72-c/100_0543.JPG' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7774178872217670527</id><published>2010-02-16T18:41:00.000-08:00</published><updated>2010-02-16T18:41:06.251-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='magnetometer sparkfun hmc5843 decoupling arduino'/><title type='text'>Sparkfundamentals - But can it draw circles?</title><content type='html'>I used a compass in school.&amp;nbsp; Actually two, but I would stick with the one in Geometry class as it had only one sharp point which went to the center of the circle.&lt;br /&gt;&lt;br /&gt;The other one from science pointed north.&lt;br /&gt;&lt;br /&gt;Sparkfun has created a breakout board with the wonderful HMC5843 chip.&amp;nbsp; It is a magnetometer, but to cut to the chase, it is a 3d compass.&lt;br /&gt;&lt;br /&gt;If you remember the bar magnets and lines of force (iron filings on paper with a magnet beneath) you would see the roughly elliptical shapes made by the lines of force.&lt;br /&gt;&lt;br /&gt;The same thing happens with the earth's magnetic field, but most compasses don't have an easy way to point outside of the horizontal plane.&amp;nbsp; But the field isn't flat, but varies by how far away from the magnetic pole you are.&amp;nbsp; At the north magnetic pole the north side of a compass would want to point straight down.&lt;br /&gt;&lt;br /&gt;But this chip returns X, Y and Z axes.&amp;nbsp; In an earlier post it was this chip connected to the Arduino.&amp;nbsp; One of the interesting &lt;br /&gt;&lt;br /&gt;With the capacitor pointed "north", the values returned (from San Diego, CA with magnets in the room) are: -38, -465, -566.&lt;br /&gt;&lt;br /&gt;(Code for this is at http://github.com/tz1/sparkfun in the i2cperiph directory).&lt;br /&gt;&lt;br /&gt;This is about right.&amp;nbsp; The large negative Y is toward the north, the negative X because I am west of the pole, and the large negative Z because if you draw an image of a bar magnet, the magnetic field is going into the earth.&amp;nbsp; Or maybe toward some bit of metal :).&lt;br /&gt;&lt;br /&gt;There is a rate setting for the chip, but the ones I've seen have been fast.&amp;nbsp; The "50Hz" setting gives 60+ Hz.&amp;nbsp; Sometimes as much as 75Hz.&lt;br /&gt;&lt;br /&gt;Note that earlier (and perhaps currently shipping) versions of the breakout board used a high-ESR capacitor.&amp;nbsp; It caused the chip to reset when it tried to do a measurement.&lt;br /&gt;&lt;br /&gt;Decoupling is needed because chips tend to have a power surge when they turn on.&amp;nbsp; Sometimes you can see this at home when your refrigerator or some other appliance turns on and the lights dim.&amp;nbsp; This can have two problems.&amp;nbsp; First, if the surge is large, it will cause digital signals to go wrong - if it needs to put out 2.4v, and the supply voltage at the pin drops to 2v for a few microseconds, the output will bounce or not be seen as a "1".&amp;nbsp; Worse, for chips like this that do analog, the voltage references can bounce around causing a lot of noise - if 100% means close to the power rail, but the power rail moves, what value is it really?&lt;br /&gt;&lt;br /&gt;There is a tiny note on the datasheet for the HMC5843 warning about capacitors, but not really saying what is needed in exact engineering terms.&amp;nbsp; But it warns against using tantalum or other high ESR capacitors.&amp;nbsp; ESR = effective series resistance.&amp;nbsp; Every component, if only because the connections aren't superconductors have a built-in resistor between the actual component and the connection.&amp;nbsp; Some are worse than others.&amp;nbsp; The surge for this chip is deep and fast enough that you need a capacitor to respond instantly with a lot of current, and it can't do that through any noticeable resistance.&amp;nbsp; So you have to use a common but specific kind of capacitor.&amp;nbsp; That is why on the product page, there are recommendations to add or change the capacitor.&lt;br /&gt;&lt;br /&gt;If strange things are happening, and only with this chip, and it has a fairly thick and large black capacitor opposite the connector, it probably needs to be changed.&lt;br /&gt;&lt;br /&gt;I've heard there is a fix in the works.&lt;br /&gt;&lt;br /&gt;But with the right capacitor, it works flawlessly.&amp;nbsp; They did change the capacitor on the 9DoF board which uses the same chip, and it works fine on that board where it shares the I2C bus with an ADXL345 accelerometer.&lt;br /&gt;&lt;br /&gt;There are other projects using this chip including an arduino library - google for "hmc5843 arduino" for more or check out the sparkfun forums.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7774178872217670527?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7774178872217670527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/sparkfundamentals-but-can-it-draw.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7774178872217670527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7774178872217670527'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/sparkfundamentals-but-can-it-draw.html' title='Sparkfundamentals - But can it draw circles?'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5410719764695987793</id><published>2010-02-15T22:09:00.000-08:00</published><updated>2010-02-15T22:12:56.322-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jpeg embedded huffman compression'/><title type='text'>JPEG - Huff &amp; puff</title><content type='html'>As part of my JPEG experiments, I've already done a byte per 8x8 block.&lt;br /&gt;&lt;br /&gt;http://wiki.github.com/tz1/sparkfun/two-tone-jpeg-made-incredibly-easy&lt;br /&gt;&lt;br /&gt;I wanted to try to get it down - you might think it would compress more, but the overhead of the coding prevents it.&lt;br /&gt;&lt;br /&gt;Most of the information is at:&lt;br /&gt;&lt;a class="linkification-ext" href="http://www.impulseadventure.com/photo/jpeg-huffman-coding.html" title="Linkification: http://www.impulseadventure.com/photo/jpeg-huffman-coding.html"&gt;http://www.impulseadventure.com/photo/jpeg-huffman-coding.html&lt;/a&gt;&lt;br /&gt;or from the output of his jpegsnoop program.&lt;br /&gt;&lt;br /&gt;First, there is an AC component code of 1 bit even if there is no AC on any of the blocks.&lt;br /&gt;&lt;br /&gt;Second - and here is one of the keys to understanding the JPEG bitstream - the huffman codes are followed by the magnitude codes.  That is what the "length" means, i.e. the bytes following the actual table.  The best I've come up with is about 2.5 bits.&lt;br /&gt;&lt;br /&gt;jpegsnoop doesn't split out the tree from the value.&lt;br /&gt;&lt;br /&gt;Here is the table (from the program):&lt;br /&gt;1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &lt;br /&gt;2, 1, 0,&lt;br /&gt;&lt;br /&gt;1 code of 1 bit, followed by 2 bits.  The two bits represent the values -3, -2, 2, 3 for 00, 01, 10, and 11 respectively.  0 is assigned first, so the codes would be &lt;br /&gt;[0][00] for -3&lt;br /&gt;[0][01] for -2&lt;br /&gt;[0][10] for 2&lt;br /&gt;[0][11] for 3&lt;br /&gt;The values are from the above page, at "Table 5 - Huffman DC Value Encoding".&lt;br /&gt;The next entry says there are two codes of two bits.  0 is used, so they will be 10 and 11 prefixes.  The first has a 1 bit value, which is for -1 or +1 for 0 or 1 respectively.  Continuing:&lt;br /&gt;[10][0] -1&lt;br /&gt;[10][1] 1&lt;br /&gt;And finally a zero bits code is an "end of block" marker or no change, which is the second two bit code:&lt;br /&gt;[11] 0&lt;br /&gt;&lt;br /&gt;So to encode black and white squares if it starts with black, we need to move from 50% to 0%, so luminance would be -1, the code would be [10][0](0) - the (0) is the AC component.  Then if the next block is also black, it would be an EOB or [11](0).  If it were white, we need to add +2, and that code would be [0][10](0).&lt;br /&gt;&lt;br /&gt;To recap, the huffman tree itself is:&lt;br /&gt;[0]   - two bits follow to indicate values of {-3,-2,2,3}&lt;br /&gt;[10]  - one bit follows, values {-1,1}&lt;br /&gt;[11]  - no bits follow, value is 0, the end of block marker.&lt;br /&gt;&lt;br /&gt;For chrominance values, they are encoded as (the underscore separates the tree from the luminance value code):&lt;br /&gt;0_00 -3&lt;br /&gt;0_01 -2&lt;br /&gt;10_0 -1&lt;br /&gt;11    0&lt;br /&gt;10_1 +1&lt;br /&gt;0_10 +2&lt;br /&gt;0_11 +3&lt;br /&gt;&lt;br /&gt;So to encode the bitstream:&lt;br /&gt;100110101&lt;br /&gt;you would need&lt;br /&gt;+1 -2 0 +2 0 -2 +2 -2 +2 0(eob).&lt;br /&gt;&lt;br /&gt;If you didn't mind it going between 50% gray and black or white it could be reduced:&lt;br /&gt;1, 1, 0, 0...&lt;br /&gt;1, 0,&lt;br /&gt;so [0][0] would be -1, [0][1] would be +1, and [10] would be the no change/EOB.&lt;br /&gt;&lt;br /&gt;With a white background, for things like barcodes or text it should be enough, and ends up being 3 bits (2 DC, 1 AC) per block instead of the 3.5 average above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5410719764695987793?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5410719764695987793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/jpeg-huff-puff.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5410719764695987793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5410719764695987793'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/jpeg-huff-puff.html' title='JPEG - Huff &amp; puff'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-515882116514677094</id><published>2010-02-15T20:35:00.000-08:00</published><updated>2010-02-15T20:35:58.641-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sparkfun arduino i2c pullup current mirror'/><title type='text'>Sparkfundamentals: I2C</title><content type='html'>I am starting a series about sparkfun products I've used and programmed for.&lt;br /&gt;&lt;br /&gt;I use a lot of I2C devices on breakout boards, and Atmel devices have two common interfaces - USI or "universal serial interface" common on the ATtiny series, and the TWI or "two wire interface" common on the ATmega series.&amp;nbsp; I've written about my USI driver here so search the archives.&amp;nbsp; But I more commonly use an Arduino:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://lh4.ggpht.com/_F0DRJg2NK8o/S3oc_XZoqHI/AAAAAAAABLI/a8jpsNcqf44/s1600/101_0539.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_F0DRJg2NK8o/S3oc_XZoqHI/AAAAAAAABLI/a8jpsNcqf44/s320/101_0539.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Here you see the 3.3v Arduino pro connected to a 3.3v FTDI breakout wiht the 3.3v and Ground from the pins (hidden behind in the picture) and SDA/SCL from the two right angle pins in the middle going to an HMC5843 breakout.&lt;br /&gt;&lt;br /&gt;My i2cperiph code over at github (http://github.com/sparkfun) uses this setup.&amp;nbsp; All I have to do is attach the 4 pins and since the Arduino can enable pullups on the TWI pins I can just plug and play.&lt;br /&gt;&lt;br /&gt;A better way of doing pullups is with a current mirror.&amp;nbsp; A circuit is at http://www.i2cchip.com/constant_current_pullup.html&amp;nbsp; but you can use four 2N3906s or a BCV62 as shown in the article, though it is a surface mount device.&amp;nbsp; That would make a nice breakout board.&amp;nbsp; And I wish SparkFun would standardize the I2C breakouts to correspond to the Arduino pins on the larger boards or do something so that I could just stack them and a terminator.&lt;br /&gt;&lt;br /&gt;The code over at GitHub uses an array with the length followed by the bytes to go over I2C (if the address is odd, they are read and filled in).&amp;nbsp; It produces a restart condition until it gets a length of zero where it sends a stop.&amp;nbsp; This makes changing code easy for most things as I just have to create a table with commands.&amp;nbsp; Where it doesn't work as well is when I have to put pauses in the stream or do other things like change what I do based on a response.&amp;nbsp; Most of the time they can be separate commands but sometimes they have to be integrated with the communication.&amp;nbsp; For now, it works well to exercise the hardware and print out results to a terminal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-515882116514677094?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/515882116514677094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/sparkfundamentals-i2c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/515882116514677094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/515882116514677094'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/sparkfundamentals-i2c.html' title='Sparkfundamentals: I2C'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_F0DRJg2NK8o/S3oc_XZoqHI/AAAAAAAABLI/a8jpsNcqf44/s72-c/101_0539.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1868638778879402287</id><published>2010-02-15T09:46:00.000-08:00</published><updated>2010-02-15T09:46:31.619-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jpeg eyefi embedded'/><title type='text'>EyeFi and JPEG over at github</title><content type='html'>My notes on getting the EyeFi to upload jpegs bearing other data:&lt;br /&gt;&lt;br /&gt;http://wiki.github.com/tz1/sparkfun/automatic-wireless-uploading-with-the-eye-fi&lt;br /&gt;&lt;br /&gt;And how to create JPEGs with black and white pixels easily:&lt;br /&gt;&lt;br /&gt;http://wiki.github.com/tz1/sparkfun/two-tone-jpeg-made-incredibly-easy&lt;br /&gt;&lt;br /&gt;Where is this leading?&amp;nbsp; Think bar codes.&amp;nbsp; I'm looking into QR codes (though the reed-solomon error correction might be a deal breaker for embedded), but the general idea is to have thumbnails you can scan with a smartphone or other imaging scanner.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1868638778879402287?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1868638778879402287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/eyefi-and-jpeg-over-at-github.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1868638778879402287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1868638778879402287'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/eyefi-and-jpeg-over-at-github.html' title='EyeFi and JPEG over at github'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8351435325717540220</id><published>2010-02-13T23:59:00.000-08:00</published><updated>2010-02-14T08:36:57.388-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino strobe xenon timing'/><title type='text'>Strobe - pics and video</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;A commenter pointed out I omitted them, and since I've finished some other projects, I'm returning to this. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This is the less expensive timing light from Harbor Freight&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a class="linkification-ext" href="http://harleyhacking.blogspot.com/2010/01/strobe-smaller-cheaper-easier.html" title="Linkification: http://harleyhacking.blogspot.com/2010/01/strobe-smaller-cheaper-easier.html"&gt;http://harleyhacking.blogspot.com/2010/01/strobe-smaller-cheaper-easier.html&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;One warning - the flyback transformer that powers the 300+ volts (the black box with the blue vertical stripe in the middle) will get very hot if you have it on continuously - I'm looking into a heat sink.&amp;nbsp; But it does seem to keep up.&amp;nbsp; The board doesn't seem to be of the highest quality, but for $12 and a fairly fast speed, I can't complain.&amp;nbsp; (The disposable camera flashes take a brief time to charge so can't normally be used like this). &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_F0DRJg2NK8o/S3erBAo-w3I/AAAAAAAABJ8/NFJdvQHXo6w/s320/101_0537.JPG" /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://lh3.ggpht.com/_F0DRJg2NK8o/S3erCd1qWJI/AAAAAAAABKI/b6O09vKZl_w/s1600/101_0538.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_F0DRJg2NK8o/S3erCd1qWJI/AAAAAAAABKI/b6O09vKZl_w/s320/101_0538.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The yellow wire is +, the short black from the corner is - and it runs on 12v, but goes down to 9 (a NiMH 9v works), and probably up as well.&amp;nbsp; These came from the battery clips&amp;nbsp; The long wire to the center is capacitively coupled to the triggering mechanism, so will flash on the right edge.&lt;br /&gt;&lt;br /&gt;And I have a fan video:&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/S_79lT4H970&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/S_79lT4H970&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt; &lt;br /&gt;&lt;br /&gt;(YouTube has an annoyance - upload video - it doesn't appear in your list even after several minutes and refreshes, upload video again, it appears and says it works, but sometime later the first appears and the second is deleted as a duplicate).&lt;br /&gt;&amp;nbsp; &lt;br /&gt;I need to adjust the arduino software to display the current RPM and let me type it in directly (or at least the period).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8351435325717540220?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8351435325717540220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/strobe-again.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8351435325717540220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8351435325717540220'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/strobe-again.html' title='Strobe - pics and video'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_F0DRJg2NK8o/S3erBAo-w3I/AAAAAAAABJ8/NFJdvQHXo6w/s72-c/101_0537.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3152664829133816139</id><published>2010-02-06T09:53:00.000-08:00</published><updated>2010-02-06T10:26:02.812-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SD SDHC flash memory latency erase'/><title type='text'>Flash Dance on SD/SDHC has intermissions.</title><content type='html'>Most of the time the SDHC cards will work really fast.&amp;nbsp; Then there is this long pause.&lt;br /&gt;&lt;br /&gt;The SD Group Simplified Specification V 2.00 sheds light on what is happening.&lt;br /&gt;&lt;br /&gt;On page 45, it says that it may take 100mS for read and 250mS for write for timeouts, or 100x longer than the typical time.&lt;br /&gt;&lt;br /&gt;Page 70 has a curve.&amp;nbsp; Basically it is an exponential reduction proportional to how full the card is, and at about 30% full it shows performance drops to HALF the original rating.&amp;nbsp; And the curves are very steep at the start.&lt;br /&gt;&lt;br /&gt;There are allocation units - and these are erasable blocks, but also recording units which are the "sectors" (or maybe multiples)&lt;br /&gt;&lt;br /&gt;Write Performance and Read Performance are left blank, but it shows a ratio of used to free.&lt;br /&gt;&lt;br /&gt;Basically as you use more and more flash, the complex algorithms kick in to map your sector to one of these units, move them, erase pages, etc.&amp;nbsp; Except for the latency, this is transparent.&lt;br /&gt;&lt;br /&gt;So for something like the using it on an embedded system, unless you completely erase the card first it can have frequent high-latency periods and lose data at high baud rates unless you have a big buffer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3152664829133816139?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3152664829133816139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/flash-dance-on-sdsdhc-has-intermissions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3152664829133816139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3152664829133816139'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/02/flash-dance-on-sdsdhc-has-intermissions.html' title='Flash Dance on SD/SDHC has intermissions.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4668018332776798791</id><published>2010-01-24T21:33:00.000-08:00</published><updated>2010-01-24T21:33:30.938-08:00</updated><title type='text'>github restore</title><content type='html'>&amp;nbsp;With a few strange links I can download, and they apparently have an old caching problem causing the problems which are fixed at least for me.&lt;br /&gt;&lt;br /&gt;Since I was offline, I decided to refactor the build directories so the stuff which talks to sparkfun hardware is in:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/tz1/sparkfun"&gt;http://github.com/tz1/sparkfun&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Most of the rest of the Atmel/Arduino stuff is in&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/tz1/partsbox"&gt;http://github.com/tz1/partsbox&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4668018332776798791?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4668018332776798791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github-restore.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4668018332776798791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4668018332776798791'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github-restore.html' title='github restore'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-5178154632879050099</id><published>2010-01-23T19:16:00.000-08:00</published><updated>2010-01-23T19:16:40.111-08:00</updated><title type='text'>My viceousness toward virtual entities.</title><content type='html'>My frustration with GitHub exposes a rule of the internet:&lt;br /&gt;&lt;b&gt;&lt;br /&gt;If you want a purely faceless, robotic, collective, virtual internet presence, don't expect to be treated like a real human because you are doing your best to completely dehumanize the transaction.&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;GitHub isn't unique.  It is cheap to NOT have more than one email address for contact, just web forms.  No phone number anywhere.  No address, not even the country whom/whatever are based in.  Whois returns some information...&lt;br /&gt;&lt;br /&gt;I overreacted, and might even want to apologize - if there was an actual human to apologize to.  Oh well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-5178154632879050099?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/5178154632879050099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/my-viceousness-toward-virtual-entities.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5178154632879050099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/5178154632879050099'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/my-viceousness-toward-virtual-entities.html' title='My viceousness toward virtual entities.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8326013865081314910</id><published>2010-01-23T17:06:00.000-08:00</published><updated>2010-02-05T14:10:10.526-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fat32 sdhc jpegtrigger eyefi'/><title type='text'>EyeFi + JPEGtrigger = instant netcam</title><content type='html'>Yes, it does work.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_F0DRJg2NK8o/S1vBvaKOrnI/AAAAAAAABIk/PTCoMSnU-9g/s1600-h/100_0532.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_F0DRJg2NK8o/S1vBvaKOrnI/AAAAAAAABIk/PTCoMSnU-9g/s320/100_0532.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Still some instability, maybe hardware, or software adjustments (921600 baud can hiccup).&lt;br /&gt;&lt;br /&gt;&lt;a class="linkification-ext" href="http://www.zdez.org/dcimmer.zip" title="Linkification: http://www.zdez.org/dcimmer.zip"&gt;http://www.zdez.org/dcimmer.zip&lt;/a&gt; - 100 images, checks the port D pins and should continually record, but this also needs verification.&lt;br /&gt;&lt;br /&gt;(update - the current tree is at &lt;a href="http://github.com/tz1/sparkfun"&gt;http://github.com/tz1/sparkfun&lt;/a&gt; in the dcimmer directory)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8326013865081314910?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8326013865081314910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/eyefi-jpegtrigger-instant-netcam.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8326013865081314910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8326013865081314910'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/eyefi-jpegtrigger-instant-netcam.html' title='EyeFi + JPEGtrigger = instant netcam'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_F0DRJg2NK8o/S1vBvaKOrnI/AAAAAAAABIk/PTCoMSnU-9g/s72-c/100_0532.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6515896473299152278</id><published>2010-01-23T16:57:00.000-08:00</published><updated>2010-01-23T18:28:00.716-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='github'/><title type='text'>GitHub has SOME support and is broken</title><content type='html'>(Edited - GitHub did get back)&lt;br /&gt;&lt;br /&gt;I can't upload.  Actually I uploaded one thing, but the second would silently fail and just show the select file.  I reported it somewhere on Friday and got no response or acknowledgment even now.  They use some flash app that worked once, but the next time would bring up the file dialog, but ignore the fact I selected a file without any error message or anything I could guess at.  Why they use flash instead of plain HTML forms?  I don't know.  In any case I can't upload to the download section of their pages.&lt;br /&gt;&lt;br /&gt;Something went wrong with one of my repositories so I deleted it.  Or thought I did.  It created a zombie repository, so I couldn't refill it with the correct files, I could go there and it shows the "new repository" screen but I can't do anything with it.  Apparently &lt;b&gt;they did get back to me shortly thereafter &lt;/b&gt;but the email or something was delayed.  Apparently they are working on this problem.&lt;br /&gt;&lt;br /&gt;I hope they will fix it, but I find it frustrating.  Things don't work, some times I get a reply, sometimes I don't, and I'm trying to get some work done this weekend.&lt;br /&gt;&lt;br /&gt;I've removed the repositories while I look for some alternative.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6515896473299152278?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6515896473299152278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github-has-no-support-and-is-broken.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6515896473299152278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6515896473299152278'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github-has-no-support-and-is-broken.html' title='GitHub has SOME support and is broken'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4712946482543031539</id><published>2010-01-21T15:14:00.001-08:00</published><updated>2010-01-21T15:14:48.448-08:00</updated><title type='text'>GitHub</title><content type='html'>Starting to put stuff up on GitHub:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/tz1"&gt;http://github.com/tz1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Lots of stuff is there already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4712946482543031539?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4712946482543031539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4712946482543031539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4712946482543031539'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/github.html' title='GitHub'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2551023558649619888</id><published>2010-01-20T16:10:00.000-08:00</published><updated>2010-01-20T16:10:47.256-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sparkfun jpeg serial camera'/><title type='text'>Sparkfun's serial jpeg camera in C (with 921600 baud shift - over 1fps)</title><content type='html'>For linux, mostly.  C/stdio/termios.  Run gthumb cam.jpg after the file exists and you can see it update.&lt;br /&gt;&lt;pre&gt;#include &amp;lt;stdio.h&gt;&lt;br /&gt;#include &amp;lt;string.h&gt;&lt;br /&gt;#include &amp;lt;termios.h&gt;&lt;br /&gt;#include &amp;lt;unistd.h&gt;&lt;br /&gt;#include &amp;lt;fcntl.h&gt;&lt;br /&gt;#include &amp;lt;stdlib.h&gt;&lt;br /&gt;&lt;br /&gt;static int serfd;&lt;br /&gt;static struct termios tio;&lt;br /&gt;&lt;br /&gt;static int seravail(unsigned long tmo)&lt;br /&gt;{&lt;br /&gt;    struct timeval tv = { 0L, tmo };&lt;br /&gt;    fd_set fds;&lt;br /&gt;    FD_ZERO(&amp;fds);&lt;br /&gt;    FD_SET(serfd, &amp;fds);&lt;br /&gt;    tv.tv_usec = tmo;&lt;br /&gt;    int i = select(serfd + 1, &amp;fds, NULL, NULL, &amp;tv);&lt;br /&gt;    return i;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void readlen(unsigned char *buf, unsigned len)&lt;br /&gt;{&lt;br /&gt;    int i = 0;&lt;br /&gt;    while (i &amp;lt; len) {&lt;br /&gt;        seravail(10000);&lt;br /&gt;        i += read(serfd, &amp;buf[i], len - i);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static unsigned char cmdjpeg[6] = "\xAA\x01\x00\x07\x00\x07";&lt;br /&gt;static unsigned char cmdreq[6] = "\xAA\x04\x05\x00\x00\x00";&lt;br /&gt;static unsigned char cmdsnap[6] = "\xAA\x05\x00\x00\x00\x00";&lt;br /&gt;static unsigned char cmdp512[6] = "\xAA\x06\x08\x00\x02\x00";&lt;br /&gt;static unsigned char cmdbaud[6] = "\xAA\x07\x01\x01\x00\x00";&lt;br /&gt;static unsigned char cmdrst[6] = "\xAA\x08\x00\x00\x00\x00";&lt;br /&gt;static unsigned char cmdsync[6] = "\xAA\x0D\x00\x00\x00\x00";&lt;br /&gt;static unsigned char cmdack[6] = "\xAA\x0E\x0D\x00\x00\x00";&lt;br /&gt;static unsigned char cmdnak[6] = "\xAA\x0F\x00\x00\x00\x00";&lt;br /&gt;&lt;br /&gt;static int cmdwack(unsigned char *cmd)&lt;br /&gt;{&lt;br /&gt;    unsigned char buf[6];&lt;br /&gt;    unsigned char max = 3;&lt;br /&gt;    while (max--) {&lt;br /&gt;        write(serfd, cmd, 6);&lt;br /&gt;        if (!seravail(5000)) {&lt;br /&gt;            printf("cmd %x timeout\n", cmd[1]);&lt;br /&gt;            continue;&lt;br /&gt;        }&lt;br /&gt;        readlen(buf, 6);&lt;br /&gt;        if (memcmp(cmdack, buf, 2)) {&lt;br /&gt;            if (!memcmp(cmdnak, buf, 3))&lt;br /&gt;                printf("cmd %x NAK %x\n", cmd[1], buf[4]);&lt;br /&gt;            else&lt;br /&gt;                printf("cmd %x badack %x %x %x %x\n", cmd[1], buf[0], buf[1], buf[2], buf[3]);&lt;br /&gt;            continue;&lt;br /&gt;        }&lt;br /&gt;        if (buf[2] == cmd[1])&lt;br /&gt;            return 0;&lt;br /&gt;        printf("cmd %x misack\n", cmd[1]);&lt;br /&gt;    }&lt;br /&gt;    return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;    unsigned char buf[520];&lt;br /&gt;    unsigned long xsize, size;&lt;br /&gt;    unsigned i;&lt;br /&gt;    unsigned len;&lt;br /&gt;    unsigned cks;&lt;br /&gt;    unsigned maxpkt;&lt;br /&gt;    unsigned pktnum;&lt;br /&gt;    unsigned char bigbuf[256000], *bp;&lt;br /&gt;    int outfd;&lt;br /&gt;&lt;br /&gt;    outfd = open("cam.jpg", O_RDWR | O_CREAT, 0644);&lt;br /&gt;    if( outfd &amp;lt; 0 )&lt;br /&gt;        return -11;&lt;br /&gt;    serfd = open("/dev/ttyUSB0", O_RDWR);&lt;br /&gt;    if (serfd &amp;lt; 0)&lt;br /&gt;        return -10;&lt;br /&gt;    if ((tcgetattr(serfd, &amp;tio)) == -1)&lt;br /&gt;        return -1;&lt;br /&gt;    cfmakeraw(&amp;tio);&lt;br /&gt;&lt;br /&gt;    for (;;) {&lt;br /&gt;        cfsetspeed(&amp;tio, B115200);&lt;br /&gt;        if ((tcsetattr(serfd, TCSAFLUSH, &amp;tio)) == -1)&lt;br /&gt;            return -1;&lt;br /&gt;&lt;br /&gt;        maxpkt = 300;&lt;br /&gt;        printf("start\n");&lt;br /&gt;        memset( &amp;cmdack[2], 0, 4 );&lt;br /&gt;        while (maxpkt--) {&lt;br /&gt;            write(serfd, cmdsync, 6);&lt;br /&gt;            if (!seravail(10000))&lt;br /&gt;                continue;&lt;br /&gt;            usleep(10000);&lt;br /&gt;            if (6 != read(serfd, buf, 6))&lt;br /&gt;                return -5;&lt;br /&gt;            if (memcmp(cmdack, buf, 3))&lt;br /&gt;                continue;&lt;br /&gt;            cmdack[3] = buf[3]; // may be needed&lt;br /&gt;            usleep(10000);&lt;br /&gt;            if (6 != read(serfd, buf, 6))&lt;br /&gt;                continue;&lt;br /&gt;            if (!memcmp(cmdsync, buf, 6))&lt;br /&gt;                break;&lt;br /&gt;        }&lt;br /&gt;        if (!maxpkt)&lt;br /&gt;            return -19;&lt;br /&gt;        printf("synced\n");&lt;br /&gt;        cmdack[2] = 0xd;&lt;br /&gt;        write(serfd, cmdack, 6);&lt;br /&gt;&lt;br /&gt;        cmdwack(cmdbaud);&lt;br /&gt;        cfsetspeed(&amp;tio, B921600);&lt;br /&gt;        if ((tcsetattr(serfd, TCSAFLUSH, &amp;tio)) == -1)&lt;br /&gt;            return -1;&lt;br /&gt;&lt;br /&gt;        cmdwack(cmdjpeg);&lt;br /&gt;        cmdwack(cmdp512);&lt;br /&gt;        sleep(2); // to adjust for lighting&lt;br /&gt;        for (;;) {&lt;br /&gt;            usleep(1000); // small wait requires to reset&lt;br /&gt;            cmdwack(cmdsnap);&lt;br /&gt;            cmdwack(cmdreq);&lt;br /&gt;            readlen(buf, 6);&lt;br /&gt;            size = buf[5];&lt;br /&gt;            size &amp;lt;&amp;lt;= 16;&lt;br /&gt;            size |= buf[4] &amp;lt;&amp;lt; 8;&lt;br /&gt;            size |= buf[3];&lt;br /&gt;            maxpkt = size / 506;&lt;br /&gt;            xsize = 0;&lt;br /&gt;            pktnum = 0;&lt;br /&gt;            cmdack[2] = cmdack[3] = 0;&lt;br /&gt;            bp = bigbuf;&lt;br /&gt;            while (pktnum &amp;lt;= maxpkt &amp;&amp; xsize &amp;lt; size) {&lt;br /&gt;                cmdack[4] = pktnum;&lt;br /&gt;                cmdack[5] = pktnum &gt;&gt; 8;&lt;br /&gt;                write(serfd, cmdack, 6);&lt;br /&gt;                readlen(buf, 4);&lt;br /&gt;                //if (buf[0] == 0xaa &amp;&amp; buf[1] == 0x0f) break;&lt;br /&gt;                //if (buf[0] != cmdack[4] || buf[1] != cmdack[5]) break;&lt;br /&gt;                len = buf[3] &amp;lt;&amp;lt; 8;&lt;br /&gt;                len |= buf[2];&lt;br /&gt;                //if (len &gt; 506) break;&lt;br /&gt;                xsize += len;&lt;br /&gt;                cks = buf[0] + buf[1] + buf[2] + buf[3];&lt;br /&gt;&lt;br /&gt;                readlen(buf, len);&lt;br /&gt;                for (i = 0; i &amp;lt; len; i++)&lt;br /&gt;                    cks += buf[i];&lt;br /&gt;                memcpy(bp, buf, len);&lt;br /&gt;                bp += len;&lt;br /&gt;                readlen(buf, 2);&lt;br /&gt;                if ((cks &amp; 0xff) != buf[0]) break;&lt;br /&gt;                ++pktnum;&lt;br /&gt;            }&lt;br /&gt;            cmdack[4] = cmdack[5] = 0xf0;&lt;br /&gt;            write(serfd, cmdack, 6);&lt;br /&gt;            if (size != xsize) {&lt;br /&gt;                printf("sz: %d xsz %d\n", size, xsize);&lt;br /&gt;                write(serfd, cmdrst, 6);&lt;br /&gt;                break;&lt;br /&gt;            }&lt;br /&gt;            printf("=%d\n", size);&lt;br /&gt;            write(outfd, bigbuf, size);&lt;br /&gt;            ftruncate(outfd, size);&lt;br /&gt;            lseek(outfd, 0, SEEK_SET);&lt;br /&gt;        }&lt;br /&gt;        sleep(15);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2551023558649619888?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2551023558649619888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/sparkfuns-serial-jpeg-camera-in-c-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2551023558649619888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2551023558649619888'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/sparkfuns-serial-jpeg-camera-in-c-with.html' title='Sparkfun&apos;s serial jpeg camera in C (with 921600 baud shift - over 1fps)'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3490827248669442099</id><published>2010-01-19T12:49:00.000-08:00</published><updated>2010-01-19T12:49:12.191-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Atmel bootstrap FAT32 SDHC'/><title type='text'>FATmel32 bootstrapping</title><content type='html'>Proof of concept&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.zdez.org/booter-0.1.zip"&gt;Booter&lt;/a&gt; is a proof of concept.&amp;nbsp; If you have a normally formatted SDHC card (have windows erase and create 1 partition with FAT32), and have a file named ATMELOAD.BIN, it will send it out the serial port at 57600 baud from an OpenLog.&lt;br /&gt;&lt;br /&gt;The base code is just under 2K, so it could probably do read and flash (LPM/compare/Erase/SPM) if different in the given space.&amp;nbsp; With main (and the single multiply from the library, interrupt vectors and other stuff) it is just over 2k.&lt;br /&gt;&lt;br /&gt;This would allow people to reflash by just inserting the cards.&amp;nbsp; This would be far easier when the system is connected for logging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3490827248669442099?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3490827248669442099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/fatmel32-bootstrapping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3490827248669442099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3490827248669442099'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/fatmel32-bootstrapping.html' title='FATmel32 bootstrapping'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6490449566350100781</id><published>2010-01-18T20:21:00.000-08:00</published><updated>2010-02-24T19:14:21.232-08:00</updated><title type='text'>Barometric pressure, or doing Pascals in C.  Plus magnetometer, LCDs</title><content type='html'>I've been working on I2C.  The latest is the VTI SCP-1000, D11 I2C version.&lt;br /&gt;&lt;br /&gt;So I have a &lt;a href="http://www.zdez.org/i2cperiph.zip"&gt;new archive with the test source&lt;/a&gt; (the display version just counts, but the others write to the UART at 57600 baud).&lt;br /&gt;&lt;br /&gt;A more recent version is at &lt;a href="http://github.org/tz1/sparkfun/"&gt;github&lt;/a&gt; in the i2cperiph directory.&lt;br /&gt;&lt;br /&gt;It also includes source for the newhaven 2x16 and 2x20 LCDs, the ADXL345 accelerometer and the HMC5843 magnetometer.&lt;br /&gt;&lt;br /&gt;(updated to include accelerometer)&lt;br /&gt;&lt;br /&gt;I used the breakout board DigiKey PN 551-1044-ND and one of those 0.6 inch wide component headers - the type you typically use to hold resistors or capacitors or things.  I simply wired all the Vdd and Vss lines together.&lt;br /&gt;&lt;br /&gt;SDA in yellow, SCL in green, 3.3v in red, and ground in black.&lt;br /&gt;&lt;br /&gt;Pin 1 is at the bottom left of the baro.  The top of the arduino pro has the Vcc and Ground pins.  SDA and SCL come out the middle.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh3.ggpht.com/_F0DRJg2NK8o/S4XkZ_220jI/AAAAAAAABV4/CkmVlH_Lcs4/s576/100_0562.JPG" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh6.ggpht.com/_F0DRJg2NK8o/S4Xmq40lOXI/AAAAAAAABUs/yQaa2jhfYbg/s576/100_0566.JPG" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://lh5.ggpht.com/_F0DRJg2NK8o/S4XmzOB3NxI/AAAAAAAABU4/I2VgJ1obRnQ/s720/100_0567.JPG" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6490449566350100781?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6490449566350100781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/barometric-pressure-or-doing-pascals-in.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6490449566350100781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6490449566350100781'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/barometric-pressure-or-doing-pascals-in.html' title='Barometric pressure, or doing Pascals in C.  Plus magnetometer, LCDs'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_F0DRJg2NK8o/S4XkZ_220jI/AAAAAAAABV4/CkmVlH_Lcs4/s72-c/100_0562.JPG' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6030776731440261381</id><published>2010-01-17T12:57:00.000-08:00</published><updated>2010-02-10T07:01:12.410-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='strobe'/><title type='text'>Strobe, smaller, cheaper, easier</title><content type='html'>Earlier I posted my frozen fan pictures using an adapted engine timing light, as well as LED.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.harborfreightusa.com/usa/itemdisplay/displayItem.do?itemid=3343"&gt;Harbor Freight model 03343&lt;/a&gt; is actually easier to adapt, smaller and CHEAPER! than the earlier strobe.&lt;br /&gt;&lt;br /&gt;It has only power, ground, and flash, the latter through a capacitor so any small pulse will trigger it.&lt;br /&gt;&lt;br /&gt;Same brightness.  $12 through the beginning of Feburary.&lt;br /&gt;&lt;br /&gt;I need to update to "dial an RPM" version, now that I have more hardware&lt;br /&gt;&lt;br /&gt;(I need to redo the setup and take another set of pics)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6030776731440261381?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6030776731440261381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/strobe-smaller-cheaper-easier.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6030776731440261381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6030776731440261381'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/strobe-smaller-cheaper-easier.html' title='Strobe, smaller, cheaper, easier'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8967363396308878110</id><published>2010-01-16T16:40:00.000-08:00</published><updated>2010-01-16T16:40:48.367-08:00</updated><title type='text'>Upload text to the internet automatically via EyeFi</title><content type='html'>There seems to be some limit - only files over 28K will be uploaded from the card, so you can't do small things.  Fortunately each text comment can be just under 64k.&lt;br /&gt;&lt;br /&gt;So, Just create a valid black 1x1 dot.  There may be a more minimalist jpeg file, but this was the best off the cuff.&lt;br /&gt;&lt;br /&gt;Split it where you put comment metadata.&lt;br /&gt;Write out first part of file.&lt;br /&gt;Read text (binary should work too!), &lt;br /&gt;Encapsulate and write out one or more FF FE lh ll (lhll - 2 bytes of data) jpeg comment records.&lt;br /&gt;Write out final part of file.&lt;br /&gt;&lt;br /&gt;Use the &lt;a href=http://en.wikipedia.org/wiki/Design_rule_for_Camera_File_system&gt;DCF&lt;/a&gt; rules to write it to the EyeFi.  Wait for it to upload to your favorite site (in my case picasa).  Find the black squares which display as pixels and download.  Reverse the FFFEdlen encapsulation and the data is intact!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;unsigned char dotjpg0[] = {&lt;br /&gt;0xff,0xd8,0xff,0xe0,0x00,0x10,0x4a,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x00,0x48,&lt;br /&gt;0x00,0x48,0x00,0x00 };&lt;br /&gt;&lt;br /&gt;unsigned char dotjpg9[] = {&lt;br /&gt;0xff,0xdb,0x00,0x43,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0x00,0x43,0x01,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff&lt;br /&gt;,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0&lt;br /&gt;,0x00,0x11,0x08,0x00,0x01,0x00,0x01,0x03,0x01,0x22,0x00,0x02,0x11,0x01,0x03,0x11&lt;br /&gt;,0x01,0xff,0xc4,0x00,0x15,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00&lt;br /&gt;,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xc4,0x00,0x14,0x10,0x01,0x00,0x00&lt;br /&gt;,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xc4&lt;br /&gt;,0x00,0x14,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00&lt;br /&gt;,0x00,0x00,0x00,0x00,0xff,0xc4,0x00,0x14,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00&lt;br /&gt;,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xda,0x00,0x0c,0x03,0x01&lt;br /&gt;,0x00,0x02,0x11,0x03,0x11,0x00,0x3f,0x00,0x98,0x00,0xff,0xd9 };&lt;br /&gt;&lt;br /&gt;unsigned char textbuf[65536] = { 0xff, 0xfe };&lt;br /&gt;&lt;br /&gt;main() {&lt;br /&gt;    int len;&lt;br /&gt;    fwrite(dotjpg0,1,sizeof(dotjpg0),stdout);&lt;br /&gt;&lt;br /&gt;    for(;;) {&lt;br /&gt;        len = fread(&amp;textbuf[4],1,65532,stdin); &lt;br /&gt;        if( len &lt;= 0 )&lt;br /&gt;            break;&lt;br /&gt;        len += 2;&lt;br /&gt;        textbuf[2] = len &gt;&gt; 8;&lt;br /&gt;        textbuf[3] = len;&lt;br /&gt;        fwrite(textbuf,len+2,1,stdout);&lt;br /&gt;    }&lt;br /&gt;    fwrite(dotjpg9,1,sizeof(dotjpg9),stdout);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8967363396308878110?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8967363396308878110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/upload-text-to-internet-automatically.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8967363396308878110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8967363396308878110'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/upload-text-to-internet-automatically.html' title='Upload text to the internet automatically via EyeFi'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4178348709748350932</id><published>2010-01-16T09:35:00.000-08:00</published><updated>2010-01-16T09:35:19.772-08:00</updated><title type='text'>-lF@2^5 0.3a</title><content type='html'>&lt;a href="http://www.zdez.org/fat32lib-0.3a.zip"&gt;fat32 library 0.3a&lt;/a&gt;, with high-performance SDHC.&lt;br /&gt;&lt;br /&gt;Still have things on the TODO.  SDHC runs near the maximum (OpenLog has an 8MHz SPI clock, and I'm transferring just below that).  Uart is now interrupt driven.  Should work at 115200 baud worst case (allocating and linking a new cluster when needed WRWRW pattern).  I noticed my class 2 were busy a lot longer than class 6.&lt;br /&gt;&lt;br /&gt;sdhc.o is bigger.  1. I have found other samples and specs so it is a more accurate implementation of the spec.  2. I added a "get number of sectors" function which can be used.  3. The superfast read/write block add a little.&lt;br /&gt;&lt;br /&gt;I'm still deciding if this might work better as a library.  I need to split the busy-while-write or otherwise handle the case since it is now much larger than the actual transfer of data.&lt;br /&gt;&lt;br /&gt;Also the read access time - things might be faster if I did multi-block, but for now I will leave it.  It isn't that bad.&lt;br /&gt;&lt;br /&gt;Meanwhile I have on order a jpeg trigger and camera from SparkFun.  I plan on getting the camera up to 921400 baud, and to use my lib to store onto my EyeFi.  DealExtreme has an &lt;a href="http://www.dealextreme.com/details.dx/sku.27001"&gt;adapter&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4178348709748350932?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4178348709748350932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/lf25-03a.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4178348709748350932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4178348709748350932'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/lf25-03a.html' title='-lF@2^5 0.3a'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-584498989232392724</id><published>2010-01-16T00:03:00.000-08:00</published><updated>2010-01-16T00:03:59.723-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr arduino spi sdhc tutorial howto optimize'/><title type='text'>SDHC at top speed, SPI, optimization tutorial</title><content type='html'>&lt;pre&gt;I wanted to speed things up.  SPI is set to f/2 on a 16MHz m328p, so&lt;br /&gt;it generates an 8MHz SPI clock.&lt;br /&gt;&lt;br /&gt;I didn't bother with the wait-for-whatever since if it takes&lt;br /&gt;200 mS to access, I might change 202 mS to 201.&lt;br /&gt;&lt;br /&gt;But a scope showed block transfers having 8 clocks at 8MHz, with huge&lt;br /&gt;gaps, taking over a millisecond just for the send or receive.  I could&lt;br /&gt;do a lot better - the time between SPI transfers should be only a few&lt;br /&gt;clocks if not zero.&lt;br /&gt;&lt;br /&gt;Here is the original receive routine:&lt;br /&gt;&lt;br /&gt;static void recvspiblock(u16 len)&lt;br /&gt;{&lt;br /&gt;    u8 *buf = filesectbuf;&lt;br /&gt;    while (len--) {&lt;br /&gt;        SPDR = 0xff;&lt;br /&gt;        while (!(SPSR &amp; 0x80));&lt;br /&gt;        SPSR &amp;= 0x7f;&lt;br /&gt;        *buf++ = SPDR;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The problem is mostly with:&lt;br /&gt;&lt;br /&gt;        while (!(SPSR &amp; 0x80));&lt;br /&gt;        SPSR &amp;= 0x7f;&lt;br /&gt;&lt;br /&gt;To translate,&lt;br /&gt;   Loop:&lt;br /&gt;        Initiate Transfer&lt;br /&gt;   Loop1:&lt;br /&gt;        Read the status register&lt;br /&gt;        (if it becomes ready right here we will need an extra loop)&lt;br /&gt;        Check the status bit&lt;br /&gt;        If the status bit was not set in the read, go to Loop1.&lt;br /&gt;        Reread the status register (need assembler or a smarter compiler)&lt;br /&gt;        mask off the interrupt bit&lt;br /&gt;        Write back the Status Register&lt;br /&gt;&lt;br /&gt;Note that we can start the next transfer as early as a successful read&lt;br /&gt;with the bit set, but it takes time to determine it.  Also we know how&lt;br /&gt;many cycles it will take (within a few).  So why are we doing all the&lt;br /&gt;housekeeping including the copy to buffer and the end check before&lt;br /&gt;starting the next transfer.&lt;br /&gt;&lt;br /&gt;The best case is:&lt;br /&gt;&lt;br /&gt;    Initiate Transfer&lt;br /&gt;    Loop:&lt;br /&gt;        tick until SPI must be done (bit or no bit)&lt;br /&gt;        Initiate Transfer&lt;br /&gt;        do housekeeping&lt;br /&gt;        go to Loop.&lt;br /&gt;&lt;br /&gt;This way, as soon as it is ready, we initiate a new cycle.  We have to&lt;br /&gt;protect the edge cases - pump priming and shutdown.  The current&lt;br /&gt;version looks like:&lt;br /&gt;&lt;br /&gt;static void recvspiblock(u16 len)&lt;br /&gt;{&lt;br /&gt;    u8 *buf = filesectbuf;&lt;br /&gt;    if( !len )&lt;br /&gt;        return;&lt;br /&gt;    SPDR = 0xff;&lt;br /&gt;    while(--len) {&lt;br /&gt;        asm( "nop" ); // 9 nop == 9 cycles&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        asm( "nop" );&lt;br /&gt;        SPDR = 0xff;&lt;br /&gt;        *buf++ = SPDR; // double buffered&lt;br /&gt;    }&lt;br /&gt;    while (!(SPSR &amp; 0x80));&lt;br /&gt;    SPSR &amp;= 0x7f;&lt;br /&gt;    *buf = SPDR;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;It works. and is much faster.  The housekeeping is done between&lt;br /&gt;triggers.&lt;br /&gt;&lt;br /&gt;Using the -s to generate the assembly shows the instructions so you&lt;br /&gt;can count the cycles.&lt;br /&gt;&lt;br /&gt;recvspiblock:&lt;br /&gt; movw r20,r24&lt;br /&gt; lds r22,filesectbuf&lt;br /&gt; lds r23,(filesectbuf)+1&lt;br /&gt; sbiw r24,0&lt;br /&gt; breq .L10&lt;br /&gt;//prime pump&lt;br /&gt; ldi r24,lo8(-1)&lt;br /&gt; out SPDR,r24            1&lt;br /&gt; movw r18,r20            1&lt;br /&gt; movw r30,r22            1&lt;br /&gt; ldi r25,lo8(-1)         1&lt;br /&gt; rjmp .L7                2&lt;br /&gt;//loop&lt;br /&gt;.L8:&lt;br /&gt;        .rept 9&lt;br /&gt; nop                     1x9&lt;br /&gt;        .endr&lt;br /&gt; out SPDR,r25            1&lt;br /&gt; in r24,SPDR             1&lt;br /&gt; st Z+,r24               2&lt;br /&gt;.L7:&lt;br /&gt; subi r18,lo8(-(-1))     1&lt;br /&gt; sbci r19,hi8(-(-1))     1&lt;br /&gt; brne .L8                2 (taken)&lt;br /&gt;//shutdown&lt;br /&gt; movw r30,r20&lt;br /&gt; sbiw r30,1&lt;br /&gt; add r30,r22&lt;br /&gt; adc r31,r23&lt;br /&gt;// original wait code here&lt;br /&gt;.L9:&lt;br /&gt; in __tmp_reg__,SPSR&lt;br /&gt; sbrs __tmp_reg__,7&lt;br /&gt; rjmp .L9&lt;br /&gt;&lt;br /&gt; in r24,SPSR&lt;br /&gt; andi r24,lo8(127)&lt;br /&gt; out SPSR,r24&lt;br /&gt; in r24,SPDR&lt;br /&gt; st Z,r24&lt;br /&gt; ret&lt;br /&gt;&lt;br /&gt;17 clocks for the central transfer loop.  16 would be the minimum, but&lt;br /&gt;it seems to need one extra to sync properly, i.e. it is ready after 16&lt;br /&gt;cycles, not on the 16th cycle.  For writes, it seems to take 1 more,&lt;br /&gt;or I'm undercounting the CPU cycles.&lt;br /&gt;&lt;br /&gt;This doesn't fix everything.  Particularly, the access time on the&lt;br /&gt;reads and busy time on the writes (which I should add a flag to say&lt;br /&gt;the write is done and buffer is available, or just do the busy check&lt;br /&gt;as part of startup - I had trouble reading too soon after writing if I&lt;br /&gt;don't wait).&lt;br /&gt;&lt;br /&gt;A newer version of my fat32lib will be posted shortly.  Includes interrupt&lt;br /&gt;driven UART, and some tweaks.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-584498989232392724?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/584498989232392724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/sdhc-at-top-speed-spi-optimization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/584498989232392724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/584498989232392724'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/sdhc-at-top-speed-spi-optimization.html' title='SDHC at top speed, SPI, optimization tutorial'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4311567591502489997</id><published>2010-01-10T07:33:00.000-08:00</published><updated>2010-01-10T15:41:49.099-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fat32 embedded openlog sdhc sdcard mmc example source arduino atmel'/><title type='text'>fat32lib 0.1, zap your card edition.</title><content type='html'>This is the first alpha, and does not include source except for the main.c menued demo.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.zdez.org/fat32lib-0.1b.zip"&gt;fat32lib-0.1b.zip&lt;/a&gt; (Update, filename editing, linux test version)&lt;br /&gt;&lt;br /&gt;Runs on SparklFun's openlog and any 3.3V arduino with the SDHC attached to the SPI pins.&lt;br /&gt;&lt;br /&gt;FAT32 ONLY, no FAT16 support, but will work on any card, e.g. a 512 byte SD card.&amp;nbsp; (I have only one which maybe should be FAT16 - a legacy spinrite and general fixup DOS boot USB with uSDHC - under 1024 cylinders for really old bioses).&amp;nbsp; Anything current typically uses FAT16.&amp;nbsp; No long filename support (see below).&lt;br /&gt;&lt;br /&gt;I'm still refactoring, which means in practice that half the lines can be changed, moved, removed, or replaced, and need to clean up some things (like using unsigned long instead of u32).&amp;nbsp; The library is fairly machine agnostic and I test using linux and ordinary 512 byte reads and writes to /dev/sdX.&lt;br /&gt;&lt;br /&gt;Right now it takes just over 8k for FAT32 with everything included, just over 1k for the SD/SDHC driver.&amp;nbsp; Just under 16K out the door with main.c and libraries (the library and driver don't need any external libraries).&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;A flashable hex file is included in the zip.&amp;nbsp; Also the library, driver, main.c, the headers and a Makefile are included which is a menued demo program similar to what OpenLog does, but no eeprom, and fixed at 57600 baud.&amp;nbsp; A space or any other unrecognized character brings up a menu.&amp;nbsp; It follows the API in fat32.h.&amp;nbsp; For logging, N return W will open a sequential log and start sending data into it.&amp;nbsp; control-z gets back to command, E and F sync the buffer and directory.&lt;br /&gt;&lt;br /&gt;Fairly feature complete - extended partitions are disabled in this build (350 bytes).&amp;nbsp; And I interlock not writing when the "current file" is a directory and not deleting directories (until I can add a directory empty check).&amp;nbsp; But it is still dangerous.&lt;br /&gt;&lt;br /&gt;I've tried to minimize extra reads and writes, but there are still a few places where it could be improved (cluster linking)&lt;br /&gt;&lt;br /&gt;Long filenames are not supported because they can straddle three sectors, have to be read backward, and need to work with unicode.&amp;nbsp; This results in ugly buffer read-writing or shuffling and would need a huge string match buffer.&amp;nbsp; For embedded applications, reading and writing 8.3 DOS names should suffice.&lt;br /&gt;&lt;br /&gt;Version 0.1b includes my high-performance SD driver source. Verified on everything from 512Mb to 16Gb, the Eye-Fi, HC and normal, version 1 and 2.  I went through the spec and tried to do the initialization properly. The transfer loops should optimize well and run fast (copyright, use at your own risk, but free for educational use, post comment for other terms).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4311567591502489997?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4311567591502489997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/fat32lib-01-zap-your-card-edition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4311567591502489997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4311567591502489997'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/fat32lib-01-zap-your-card-edition.html' title='fat32lib 0.1, zap your card edition.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1339637298202720878</id><published>2010-01-09T22:35:00.000-08:00</published><updated>2010-01-09T22:35:43.658-08:00</updated><title type='text'>a little FAT(32), new displays...</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_F0DRJg2NK8o/S0lx36DAkkI/AAAAAAAAAec/3Rd_Ni5Llnc/s1600-h/EyeFiOpenlogdisp.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_F0DRJg2NK8o/S0lx36DAkkI/AAAAAAAAAec/3Rd_Ni5Llnc/s320/EyeFiOpenlogdisp.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Some more displays 3.3v, mostly I2C from Newhaven on the left.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt; &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Openlog on the right, with an EyeFi and adapter - it signs on, but I need a "Pro" version to upload non-image files.&amp;nbsp; And I don't have the jpeg trigger camera logger version from sparkfun to try.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Meanwhile, I have written a fairly complete FAT32 (sans long filenames) implementation which fits into just over 8K.&amp;nbsp; And just over 1K for a tuned SDHC driver.&amp;nbsp; The main OpenLog source doesn't work with SDHC and FAT32 - they are linked in the current source, at least if you don't want to overwrite your bootloader.&amp;nbsp; If you enable SDHC, it changes the data size for offsets to 8 bytes, so all kinds of ordinary calculations double in size, even though SDHCs can only transfer in 512 byte units.&lt;br /&gt;&lt;br /&gt;This will allow me to record the information coming from the devices even if bluetooth isn't uploading it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1339637298202720878?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1339637298202720878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/little-fat32-new-displays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1339637298202720878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1339637298202720878'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/little-fat32-new-displays.html' title='a little FAT(32), new displays...'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_F0DRJg2NK8o/S0lx36DAkkI/AAAAAAAAAec/3Rd_Ni5Llnc/s72-c/EyeFiOpenlogdisp.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6382958033012713265</id><published>2010-01-01T09:11:00.000-08:00</published><updated>2010-01-01T09:11:18.483-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='i2c lcd display attiny'/><title type='text'>The I2C Display, Pics, problems.</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_F0DRJg2NK8o/Sz4fEEFgxlI/AAAAAAAAAd8/DoMFE2gTq40/s1600-h/00001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_F0DRJg2NK8o/Sz4fEEFgxlI/AAAAAAAAAd8/DoMFE2gTq40/s320/00001.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;It should be displaying the magnetometer on the bottom line, but you will note it is moved back (the board with the big capacitor).&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt; &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;For now it displays the output of temperature, and accelerometer (500=no gs, 0-1000) x,y,z.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Adding devices adds capacitance.&amp;nbsp; The magnetometer seems to be the worst.&amp;nbsp; The problem is that the display has a very low current sink capability so if I use lower resistance pullups, the ACK will not be seen since it will be at 1.2v or even higher instead of right near the 0v floor.&amp;nbsp; I can only go down to about 4.7k.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6382958033012713265?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6382958033012713265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/i2c-display-pics-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6382958033012713265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6382958033012713265'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2010/01/i2c-display-pics-problems.html' title='The I2C Display, Pics, problems.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_F0DRJg2NK8o/Sz4fEEFgxlI/AAAAAAAAAd8/DoMFE2gTq40/s72-c/00001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-964050039611572714</id><published>2009-12-31T06:29:00.000-08:00</published><updated>2009-12-31T06:29:58.936-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux ftdi arduino reset'/><title type='text'>linux + ftdi + arduino = no auto reset - same with openlog</title><content type='html'>None of my FTDI breakouts can actually reset an arduino.  Nor the one built-in on the arduino mega.&lt;br /&gt;&lt;br /&gt;It turns out that avrdude (or at least the version I have) doesn't toggle the line, and to do so may require some effort on the low-level software front (there is a libftdi which corks).&lt;br /&gt;&lt;br /&gt;I was able to verify the sparkfun openlog when I manually reset it (I'm still bothered that ISP didn't work, but I will need to explore that further).  It was easy since the SD card holder is grounded and right under the reset pin, so putting a wire through the hole would make contact and reset.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-964050039611572714?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/964050039611572714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/linux-ftdi-arduino-no-auto-reset-same.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/964050039611572714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/964050039611572714'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/linux-ftdi-arduino-no-auto-reset-same.html' title='linux + ftdi + arduino = no auto reset - same with openlog'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8008386329497469943</id><published>2009-12-30T20:29:00.000-08:00</published><updated>2009-12-31T17:29:39.949-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lcd i2c arduino 3.3v newhaven display'/><title type='text'>Newhaven 3.3v display working - Arduino and ATtiny</title><content type='html'>Update: ATtiny85 Works!&lt;br /&gt;&lt;br /&gt;One thing which is not clear (except with a scope) is that it does not have good current drive capability.  Some I2C busses have 3.3K.  One of the other sparkfun modules had 1K pullups on SDA and SCL!  I needed to remove them and have 12Ks and things worked (though you could see the ACK pulse was noticeably above ground and the clock pulses had a rise time which made it look like sawteeth instead of the sharp square waves).&lt;br /&gt;&lt;br /&gt;I wanted to do this since I can then use another port to time J1850 pulses and print out the data on the display, all with 3.3v, no crystal, and few components.&lt;br /&gt;&lt;br /&gt;For now, with some glitches, I have it displaying the temp, and the XYZ from both the accelerometer and magnetometer on the breadboard.  Pics to follow.&lt;br /&gt;&lt;br /&gt;Main post is at:&lt;br /&gt;&lt;br /&gt;http://www.newhavendisplay.com/forum/viewtopic.php?f=9&amp;t=86&amp;p=349#p349&lt;br /&gt;&lt;br /&gt;I don't know what I really needed to get this working.  Much hacking until the display appeared (though thanks to Curt at Newhaven who suggested trying different contrast settings - the max works much better).  I have to integrate this with my other code, but now I have a way to quickly display info from other things attached (including other I2C devices).  It is working at 400kHz.&lt;br /&gt;&lt;br /&gt;There is one subtlety where you need to send the address THEN A CONTROL BYTE then the data byte or bytes.  This is in the controller datasheet, but hard to understand, and the control bytes specifies whether you are doing control or data, and if there are more control/data pairs or if it is the last control followed by just data.&lt;br /&gt;&lt;br /&gt;I'm getting a few more - including an 8x20 (that I might have a connector for - 2m instead of 1.5), and a 100x160 character display.  All use 3.3v.  Also a larger one with bytewide bus.&lt;br /&gt;&lt;br /&gt;They have lots of neat stuff there, so check them out.  I found them via digikey, but they sell direct and the prices are very reasonable and they have boards which make prototype connection easy, which is usually the hardest part.&lt;br /&gt;&lt;br /&gt;http://www.newhavendisplay.com/&lt;br /&gt;&lt;br /&gt;I don't have the ATtiny85 talking to it yet, but having one working version should make it easier.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8008386329497469943?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8008386329497469943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/newhaven-33v-display-working.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8008386329497469943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8008386329497469943'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/newhaven-33v-display-working.html' title='Newhaven 3.3v display working - Arduino and ATtiny'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8461047722678383785</id><published>2009-12-30T08:50:00.000-08:00</published><updated>2009-12-30T08:50:21.486-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='i2c hmc5843 atmel avr'/><title type='text'>I2C - there's the spec, then there's hardware</title><content type='html'>I was having problems with the I2C using my ATtiny85 USI routine I have posted here.&lt;br /&gt;&lt;br /&gt;The HMC5843 (yes, the one that I needed to add the low ESR cap to) would only return 1 byte of data when reading, then a series of 0xff.  It acted like I was NAKing it but it was a good ACK as far as the specs were concerned (on the scope).&lt;br /&gt;&lt;br /&gt;It turned out I needed two or three NOPs right at the top of the PulseSCL macro to insure setup time for SDA.  It also doesn't work to just put the delay just before the ACK in the read routine.&lt;br /&gt;&lt;br /&gt;I've been having similar problems with some I2C displays from &lt;a href="http://www.newhavendisplay.com/"&gt;Newhaven Display&lt;/a&gt;.  They are nice in that they only need a single 3.3v supply, and run I2C.  They need a few caps since they have an on-device voltage booster, but it ends up being only 4 connections.  On an arduino, I managed to get a block and underline cursor, but no text so far.  I was getting nothing with the ATtiny, but I will need to try it with this fixed code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8461047722678383785?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8461047722678383785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/i2c-theres-spec-then-theres-hardware.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8461047722678383785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8461047722678383785'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/i2c-theres-spec-then-theres-hardware.html' title='I2C - there&apos;s the spec, then there&apos;s hardware'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4753541518542405665</id><published>2009-12-29T11:03:00.000-08:00</published><updated>2009-12-30T08:51:13.551-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='minigpsd gps maemo'/><title type='text'>latest minigpsd tarball</title><content type='html'>Yahoo, or my browser (firefox with various blocks for security like noscript, flashblock, nodirect) was having problems, but I figured out how to get the old FTP to work.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.zdez.org/minigpsd_0.31h1.tar.gz"&gt;http://www.zdez.org/minigpsd_0.31h1.tar.gz&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4753541518542405665?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4753541518542405665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/latest-minigpsd-tarball.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4753541518542405665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4753541518542405665'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/latest-minigpsd-tarball.html' title='latest minigpsd tarball'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-410719502366045793</id><published>2009-12-29T09:08:00.000-08:00</published><updated>2009-12-29T09:08:00.909-08:00</updated><title type='text'>Busy...  Magnetometer, openlog, minigpsd.</title><content type='html'>There are a few updates to minigpsd that should appear at www.zdez.org when I can get them to upload.  Mainly gpsgate was disabled if logging couldn't work (e.g. I didn't have a card in the n810).  Also I managed to get a lock and then turn off the external GPS stream (j1850 worked), and found the internal would not override the external if that happened.  That has been fixed too.&lt;br /&gt;&lt;br /&gt;Meanwhile I got the HMC5843 breakout and openlog from sparkfun.  Frustration.&lt;br /&gt;&lt;br /&gt;The HMC5843 - as per the discussion - REQUIRES YOU TO ADD AN EXTERNAL LOW-ESR CAPACITOR.  I used a 47uF electrolytic.&lt;br /&gt;&lt;br /&gt;It is not that it doesn't work at all, it does strange things - resetting, returning 0xff instead of the correct bytes, etc.  With the external cap, it seems to be working 100% (there are a few hiccups, but they are probably on the master end).&lt;br /&gt;&lt;br /&gt;The openlog won't reflash, but they really don't say how to do it.  It has some kind of arduino/stk500 style bootloader, which would help if it just worked.  Maybe the baud rate is off.  Maybe the version.  Maybe it needs to be manually reset if you use a 3.3v FTDI.  But they don't say.  Worse, the ISP pins are broken out and I can't get it to be recognized that way either.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-410719502366045793?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/410719502366045793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/busy-magnetometer-openlog-minigpsd.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/410719502366045793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/410719502366045793'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/busy-magnetometer-openlog-minigpsd.html' title='Busy...  Magnetometer, openlog, minigpsd.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3839152310713645645</id><published>2009-12-06T08:59:00.000-08:00</published><updated>2009-12-06T08:59:29.159-08:00</updated><title type='text'>The broken FTDI driver in Ubuntu Karmic</title><content type='html'>I was wondering why I was having such problems doing "cat /dev/ttyUSB0".&lt;br /&gt;&lt;br /&gt;Turns out to be a known problem - patches submitted to the kernel after the ubuntu freeze.&lt;br /&gt;&lt;br /&gt;https://bugs.launchpad.net/ubuntu/+source/linux/+bug/460857&lt;br /&gt;&lt;br /&gt;The suggestions involved a kernel rebuild, however it is just one driver from two files.&lt;br /&gt;&lt;br /&gt;So I found some other drivers and figured out how they did their quick Makefiles.&lt;br /&gt;&lt;br /&gt;Putting the following makefile (remember the indents must be tabs, not spaces) with the ftdi_sio.* files will allow you to build the module with just "make".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;tt&gt;&lt;br /&gt;KDIR:=/lib/modules/$(shell uname -r)/build&lt;br /&gt;&lt;br /&gt;EXTRA_CFLAGS += -I$(KDIR)/drivers/usb/serial -I/usr/src/linux-headers-$(shell uname -r)/include&lt;br /&gt;&lt;br /&gt;obj-m:=ftdi_sio.o&lt;br /&gt;&lt;br /&gt;default:&lt;br /&gt; $(MAKE) -C $(KDIR) $(EXTRA_CFLAGS) SUBDIRS=$(PWD) modules&lt;br /&gt;clean:&lt;br /&gt; $(RM) *.mod.c *.o *.ko .*.cmd Module.symvers Module.markers modules.order&lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3839152310713645645?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3839152310713645645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/broken-ftdi-driver-in-ubuntu-karmic.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3839152310713645645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3839152310713645645'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/broken-ftdi-driver-in-ubuntu-karmic.html' title='The broken FTDI driver in Ubuntu Karmic'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7426877066527110602</id><published>2009-12-03T18:39:00.000-08:00</published><updated>2009-12-03T18:39:48.047-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug led tips'/><title type='text'>Toolbox: 12V LEDs</title><content type='html'>These have an internal resistor, but will glow even at lower voltages (3.3-5).&amp;nbsp; So they are hard to kill and won't kill your target, but easy to hook to a port or to see if there is voltage.  $2.63/10 as of this writing&lt;br /&gt;&lt;br /&gt;The digikey part numbers are (red,yellow,green):&lt;br /&gt;67-1067-ND LED 3MM 12V SHORT LENS RED DIFF 12V&lt;br /&gt;67-1079-ND&lt;br /&gt;67-1061-ND&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7426877066527110602?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7426877066527110602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/toolbox-12v-leds.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7426877066527110602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7426877066527110602'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/toolbox-12v-leds.html' title='Toolbox: 12V LEDs'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4723380483635938440</id><published>2009-12-01T15:25:00.000-08:00</published><updated>2009-12-01T15:25:10.426-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr dragon attiny'/><title type='text'>Double Dragon</title><content type='html'>My new dragon is still working well.&amp;nbsp; I have the 40 pin ZIF socket, so I had the HVSP going to the bottom 8 pins (pin 1).&amp;nbsp; I just added the debugwire to the other end - and it works (if I use HVSP to program DWEN).&lt;br /&gt;&lt;br /&gt;Three wires, but can't change the fuses.&amp;nbsp; But the nice thing is I end up with a 3 wire solution - two are power so have to be there anyway.&lt;br /&gt;&lt;br /&gt;Now to try debugging...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4723380483635938440?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4723380483635938440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/double-dragon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4723380483635938440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4723380483635938440'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/12/double-dragon.html' title='Double Dragon'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-6723252646261344030</id><published>2009-11-28T12:51:00.000-08:00</published><updated>2009-11-28T12:55:50.450-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny megabaud macro assembler'/><title type='text'>2megabaud improved</title><content type='html'>&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;A larger but less intrusive (leaves the other port bits alone) 2 megabaud.&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;The 0xfe and 0x01 can be set to which port bit to use&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;The final ror is redundant, if you want to do .rept8 then copy the first 4 instructions or just set the stop bit at the right time.&amp;nbsp; The ret takes 4 cycles so the stop bit will be more than long enough.&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;tt&gt;&lt;br /&gt; .file "sendchar.S"&lt;br /&gt;PORTB = 0x18&lt;br /&gt; .text&lt;br /&gt;        .global sendchar&lt;br /&gt; .type sendchar, @function&lt;br /&gt;sendchar:&lt;br /&gt;        in r23,PORTB&lt;br /&gt;        andi r23,0xfe // Zeroing mask - clear port bit&lt;br /&gt;        out PORTB,r23 // start bit&lt;br /&gt;        sec           // for stop bit&lt;br /&gt;        .rept 9&lt;br /&gt;        mov r22,r23&lt;br /&gt;        sbrc r24,0&lt;br /&gt;        ori r22,0x01 // Marking mask - set port bit&lt;br /&gt;        out PORTB,r22&lt;br /&gt;        ror r24&lt;br /&gt;        .endr&lt;br /&gt;        ret&lt;br /&gt; .size sendchar, .-sendchar&lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-6723252646261344030?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/6723252646261344030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/2megabaud-improved.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6723252646261344030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/6723252646261344030'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/2megabaud-improved.html' title='2megabaud improved'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3083025473683330656</id><published>2009-11-24T19:38:00.000-08:00</published><updated>2009-12-06T09:04:29.769-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr assembly i2c example'/><title type='text'>Some assembly required, or at least good practice</title><content type='html'>&lt;pre&gt;&lt;tt&gt;I've added an i2c temp sensor which I will add later.&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;&lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;Tweaked so that every SCL pulse is uniform (1.4us low, 0.9 high, except for stop which is 1.5 low).&lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;&amp;nbsp;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;What do I look for in a good assembly program?&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;&amp;nbsp;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;Comments should point to the key points.  For example, that the write loop needs to be split into the initial and main if you want speed over space. &lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;&amp;nbsp;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;This is the current version of usi2c.S which I tried to comment properly:&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;&amp;nbsp;&lt;/tt&gt;&lt;/pre&gt;&lt;pre&gt;&lt;tt&gt;;;; copyright 2009, all rights reserved. released under the terms of the GNU&lt;br /&gt;;;; general public license V3.  See www.gnu.org for details.  For other terms,&lt;br /&gt;;;; contact tz@execpc.com&lt;br /&gt;&lt;br /&gt;;;; USI I2C for Atmel 25 and larger chips.&lt;br /&gt;&lt;br /&gt;;;; Features: Uniform frequency (9 cycles high, 14 cycles low) for SCK except&lt;br /&gt;;;; for STOP condition where it is 15 cycles low.&lt;br /&gt;&lt;br /&gt;;;; Input: Pointer to unsigned character buffer (in R24:25).&lt;br /&gt;;;; Returns any read data into same buffer.&lt;br /&gt;;;; Buffer format: One or more of: { LEN ADDR-RW BYTES }, followed by zero&lt;br /&gt;;;; LEN is the number of bytes for the transfer, the address-r/w plus any&lt;br /&gt;;;; bytes read or written.  A start condition is generated, the address is&lt;br /&gt;;;; sent, then bytes are read or written.  If there is another transfer, a&lt;br /&gt;;;; repeated start is generated, and the second transfer occurs.  Otherwise&lt;br /&gt;;;; a stop condition is generated.&lt;br /&gt;&lt;br /&gt;;;; The USI on the ATtinyx5 uses PB0 and PB2 which are properly set upon start.&lt;br /&gt;&lt;br /&gt;;;; Constants&lt;br /&gt;        &lt;br /&gt;ZERO = 1&lt;br /&gt;PORTB = 0x18&lt;br /&gt;DDRB = 0x17&lt;br /&gt;PINB = 0x16&lt;br /&gt;USIDR = 0x0f&lt;br /&gt;USISR = 0x0e&lt;br /&gt;USICR = 0x0d&lt;br /&gt;&lt;br /&gt;;;; Macros&lt;br /&gt;&lt;br /&gt;;;; Waitup - pause until the SCL line is high. Required for normal clocking and STOP&lt;br /&gt;        .macro  WaitUp&lt;br /&gt;1:      sbis PINB,2&lt;br /&gt;        rjmp 1b&lt;br /&gt;        .endm&lt;br /&gt;&lt;br /&gt;;;; PulseSCL - generate the high-time for SCL during data bit transfers.  Start and&lt;br /&gt;;;; Stop are handled separately.  Timing adjusted for minimum of 6 cycles, but normal&lt;br /&gt;;;; pullups will do 9 cycles since the test to wait for the line to actually go high&lt;br /&gt;;;; is just after the line is released so reads as 0 at the instant.&lt;br /&gt;        &lt;br /&gt;;;; r21 contains 43 (0x2b)&lt;br /&gt;        .macro PulseSCL&lt;br /&gt;        out USICR,r21           ;Toggle SCL High&lt;br /&gt;        WaitUp&lt;br /&gt;        lpm                     ;3 cycle delay&lt;br /&gt;        out USICR,r21           ;Toggle SCL Low&lt;br /&gt;        .endm&lt;br /&gt;&lt;br /&gt;;;; XFER8 - transfer 8 data bits using USISR&lt;br /&gt;        &lt;br /&gt;;;; r22 has 0xf0 for count&lt;br /&gt;        .macro Xfer8        &lt;br /&gt;        out USISR,r22&lt;br /&gt;8:      PulseSCL                ;SCL High pulse&lt;br /&gt;        sbic USISR,6            ;Exit xfer8 on interrupt&lt;br /&gt;        rjmp 9f                 ; jump to exit&lt;br /&gt;        rcall .dly7             ; 7 cycle delay&lt;br /&gt;        rjmp 6f                 ; 2 cycle delay - +1 to make it the uniform 14.&lt;br /&gt;6:      rjmp 8b                 ; loop for next bit&lt;br /&gt;9:                              ;3 cycles after SCL low&lt;br /&gt;        .endm&lt;br /&gt;&lt;br /&gt;;;; Function USIxfer Body.&lt;br /&gt;        .text&lt;br /&gt;.global USIxfer&lt;br /&gt;        .type   USIxfer, @function&lt;br /&gt;USIxfer:&lt;br /&gt;        mov r26,r24             ;Pointer to transaction to X&lt;br /&gt;;;; r19 will hold PORTB status for efficiency.  This and later sections of the&lt;br /&gt;;;; code will need to be changed to do a read-modify-write with interrupts&lt;br /&gt;;;; disabled if an interrupt can alter PORTB elsewhere.  Instead of redoing RMW&lt;br /&gt;;;; r19 will be written to PORTB.to set the pins high&lt;br /&gt;        in r19,PORTB            ;alt: sbi PORTB,0...2&lt;br /&gt;        ori r19,lo8(5)&lt;br /&gt;        out PORTB,r19&lt;br /&gt;;;; set the SDA/SCL to input.&lt;br /&gt;        in r24,DDRB&lt;br /&gt;        ori r24,lo8(5)&lt;br /&gt;        out DDRB,r24&lt;br /&gt;;;; Setup the USI registers and local values used later&lt;br /&gt;        ldi r23,lo8(-1)&lt;br /&gt;        out USIDR,r23&lt;br /&gt;        ldi r21,lo8(42)&lt;br /&gt;        out USICR,r21           ;enable USI&lt;br /&gt;        inc r21                 ;change into toggle command&lt;br /&gt;        ldi r22,lo8(-16)&lt;br /&gt;        out USISR,r22&lt;br /&gt;        rjmp .MainBot&lt;br /&gt;&lt;br /&gt;;;; X (r26/27) - pointer to message buffer&lt;br /&gt;;;; r25 - current msg length left&lt;br /&gt;;;; r24 scratchpad&lt;br /&gt;;;; r23 const 0xff&lt;br /&gt;;;; r22 const 0xf0 for 8 bits&lt;br /&gt;;;; r21 const 0x2b to toggle SCL&lt;br /&gt;;;; r20 - read/write flasg (break write loop after 1)&lt;br /&gt;;;; r19 - incoming both high PORTB image&lt;br /&gt;.MainTop:&lt;br /&gt;        out PORTB,r19           ;Set both SDA and SCL high&lt;br /&gt;.sdaupwait:&lt;br /&gt;        sbis PINB,2&lt;br /&gt;        rjmp .sdaupwait         ;wait until SDA is actually high (periph wait)&lt;br /&gt;        ld r20,X                ;save message first byte for read/write bit&lt;br /&gt;        cbi PORTB,0             ;set SDA low for start condition&lt;br /&gt;        lpm                     ;delay 3 cycles&lt;br /&gt;        rjmp 5f                 ;delay 2 cycles&lt;br /&gt;5:      &lt;br /&gt;        cbi PORTB,2             ;*** set SCL Low&lt;br /&gt;        out USIDR,ZERO          ;this prevents a cosmetic glitch on the SDA line&lt;br /&gt;        sbi PORTB,0             ;set SDA high so USI can use it&lt;br /&gt;        lpm                     ;delay 3 cycles&lt;br /&gt;        nop                     ;delay 1 for uniform 14 cycle lowtime&lt;br /&gt;        rjmp .WriteTop          ;Enter write loop&lt;br /&gt;;;; If the address or any byte is NAKed, the current transaction will end.&lt;br /&gt;.nacked:&lt;br /&gt;        add r26,r25             ;skip bytes to next length&lt;br /&gt;        adc r27,ZERO            ; set remaining length to zero&lt;br /&gt;        rjmp .PastRead          ; end this transaction&lt;br /&gt;;;; WRITE LOOP&lt;br /&gt;.WriteTop:&lt;br /&gt;        ld r24,X+               ;Get (next) message byte&lt;br /&gt;        out USIDR,r24           ;send to USI&lt;br /&gt;        Xfer8                   ; send it&lt;br /&gt;        cbi DDRB,0              ;reverse SDA direction&lt;br /&gt;        rcall .dly7             ;delay 7 cycles&lt;br /&gt;        nop                     ;one more cycle for 14 uniform&lt;br /&gt;        PulseSCL                ;Get the Ack or Nak - SCL high pulse&lt;br /&gt;        dec r25                 ;len--&lt;br /&gt;        breq .PastRead          ; no more chars, end&lt;br /&gt;;;; SDA back to out, but if we switch to read we clear it?  Maybe optimize&lt;br /&gt;        sbi DDRB,0              ;return to output&lt;br /&gt;        sbic USIDR,0            ;Did we get a NAK?&lt;br /&gt;        rjmp .nacked            ; yes, skip rest of this transaction&lt;br /&gt;;;; This causes the longest nomal path at 14 cycles.&lt;br /&gt;;;; For faster, e.g. at 8Mhz RC, it would be faster to do a split out address write,&lt;br /&gt;;;; then jump to the write or read loop instead of checking this bit each loop&lt;br /&gt;        sbrs r20,0              ;check read/write bit&lt;br /&gt;        rjmp .WriteTop          ;Back to top&lt;br /&gt;        nop                     ;delay for uniform 14&lt;br /&gt;;;; Read Loop&lt;br /&gt;.ReadTop:&lt;br /&gt;        cbi DDRB,0              ;switch to input on SDA&lt;br /&gt;        nop                     ;delay for uniform 14&lt;br /&gt;        Xfer8                   ; get data byte&lt;br /&gt;        nop                     ;delay for uniform 14&lt;br /&gt;        in r24,USIDR            ;read data byte&lt;br /&gt;        st X+,r24               ;save to buffer&lt;br /&gt;        out USIDR,r23           ;set output high (-1) in case of NAK&lt;br /&gt;        sbi DDRB,0              ;set SDA to output&lt;br /&gt;        dec r25                 ;len--&lt;br /&gt;        breq .doNAK             ;NAK of last byte - note optimize out tst r25 lower&lt;br /&gt;        out USIDR,ZERO          ;more data, Ack - drive SDA low&lt;br /&gt;.doNAK:&lt;br /&gt;        PulseSCL                ;Pulse the SCL line high to send the (n)ack&lt;br /&gt;        tst r25                 ;retest length&lt;br /&gt;        breq .PastRead          ;exit loop&lt;br /&gt;        lpm                     ;delay 3&lt;br /&gt;        rjmp 9f                 ;delay 2&lt;br /&gt;9:      rjmp .ReadTop           ;continue read at next byte&lt;br /&gt;&lt;br /&gt;.PastRead:                      ;Read (or write) complete&lt;br /&gt;        out USIDR,r23           ;set output high if USI active&lt;br /&gt;        sbi DDRB,0              ;set SDA to output&lt;br /&gt;.MainBot:&lt;br /&gt;        ld r25,X+               ;get length of (next) transaction&lt;br /&gt;        tst r25                 ;check for 0/end&lt;br /&gt;        breq .doStop            ;skip to stop conditon&lt;br /&gt;        nop                     ;delay for uniform 14&lt;br /&gt;        rjmp .MainTop           ;do next transaction&lt;br /&gt;.doStop:&lt;br /&gt;        cbi PORTB,0             ;clear SDA for STOP&lt;br /&gt;        sbi PORTB,2             ;bring SCL high&lt;br /&gt;        WaitUp                  ;wait unit it really does&lt;br /&gt;        lpm                     ;delay 3 cycles&lt;br /&gt;        sbi PORTB,0             ;Stop: Bring SDA high after 0.6&lt;br /&gt;;;;Need to hold SDA for 13 before going low again - ret - call - setup will be longer&lt;br /&gt;.dly7:  ret                     ;call to ret is 7 cycles - space efficient delay&lt;br /&gt;        .size   USIxfer, .-USIxfer&lt;br /&gt;&lt;/tt&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3083025473683330656?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3083025473683330656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/some-assembly-required-or-at-least-good.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3083025473683330656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3083025473683330656'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/some-assembly-required-or-at-least-good.html' title='Some assembly required, or at least good practice'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-514599350128454613</id><published>2009-11-23T21:42:00.000-08:00</published><updated>2009-11-23T21:42:49.613-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny lcd port expander i2c accelerometer assembly'/><title type='text'>I2C Master, mastered.</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: left;"&gt;Frustration sometimes is the mother of production.&amp;nbsp; While I wait for my new Dragon (which I need to be more careful with)...&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_F0DRJg2NK8o/SwtvKiS-pLI/AAAAAAAAAdY/C0q16A53-wo/s1600/00001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_F0DRJg2NK8o/SwtvKiS-pLI/AAAAAAAAAdY/C0q16A53-wo/s320/00001.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://www.zdez.org/tinyacc2.tgz"&gt;http://www.zdez.org/tinyacc2.tgz - source&lt;/a&gt; is here.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I don't have the COPYING file, but it is GPLv3. &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This reads the accelerometer, puts out 1 volt for flat, with more or less depending on tilt, and uses the 9555 to drive a LCD to show 100 for flat, lower or greater depending on tilt.&amp;nbsp; Not clean given the noise on the breadboard but it works.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I've made the i2c driver a bit faster and more consistent - it still needs a few adjustments, but the code paths are nearly identically long giving a very clean wave on a scope.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;There is also a reason to split or adapt the driver - things like the port and DAC will just sit there and successive writes can be done without the addressing or register selection.&amp;nbsp;&amp;nbsp; A start - continue - stop version might be next.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;But I also have got to get back to the V1 LED stuff.&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-514599350128454613?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/514599350128454613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/i2c-master-mastered.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/514599350128454613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/514599350128454613'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/i2c-master-mastered.html' title='I2C Master, mastered.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_F0DRJg2NK8o/SwtvKiS-pLI/AAAAAAAAAdY/C0q16A53-wo/s72-c/00001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8258218572332659114</id><published>2009-11-23T13:39:00.000-08:00</published><updated>2009-11-23T13:39:02.694-08:00</updated><title type='text'>Smoking Dragon, fluxed up beyond all operation.</title><content type='html'>I was out and got some soldering and electronic supplies, including a bottle of flux.&lt;br /&gt;&lt;br /&gt;I spilled a small but more than annoying amount when the bottle tipped.  Right on the Dragon.&lt;br /&gt;&lt;br /&gt;After a very thorough cleaning (flux is hard to remove in quantity), it worked for several hours, but finally the power supply chip has lost its magic smoke, so another Dragon is on order.&lt;br /&gt;&lt;br /&gt;In the meanwhile, my I2C has added the NXP PCA9555 and an LCD which was working while I'm tweaking the code paths to have better timing.  Back to the clips and the rest of the chips I didn't change the reset fuse on...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8258218572332659114?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8258218572332659114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/smoking-dragon-fluxed-up-beyond-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8258218572332659114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8258218572332659114'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/smoking-dragon-fluxed-up-beyond-all.html' title='Smoking Dragon, fluxed up beyond all operation.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-477292774500025429</id><published>2009-11-21T14:35:00.000-08:00</published><updated>2009-11-22T16:29:06.437-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr atmel high voltage serial programming flash dragon'/><title type='text'>The (AVR) Dragon, tamed.</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_F0DRJg2NK8o/SwnTkCVXQyI/AAAAAAAAAdI/_ywoQSi9fP8/s1600/100_0514.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_F0DRJg2NK8o/SwnTkCVXQyI/AAAAAAAAAdI/_ywoQSi9fP8/s320/100_0514.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5407085443690218274" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Dragon is working.  A few things I needed to do:&lt;br /&gt;&lt;br /&gt;Solder the headers for HVSP mode, then for the 40 pin passthrough for the prototyping area.&lt;br /&gt;&lt;br /&gt;I added a plain socket and a ZIF socket for the narrow devices - 8 to 28 pin - the bottom socket is so I can add the wider 40 pin if I ever need it.&lt;br /&gt;&lt;br /&gt;Then it has to be wired.&lt;br /&gt;&lt;br /&gt;http://courses.cit.cornell.edu/ee476/AtmelStuff/dragon.pdf (ATtiny2/4/85 is on page 22).&lt;br /&gt;&lt;br /&gt;It is actually very clear, the other page which has basics: http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon_HVSP_Description.htm but DOES NOT MENTION &lt;span style="font-weight:bold;"&gt;YOU MUST RUN VCC FROM THE POWER TO ISP HEADER&lt;/span&gt; ("A" in the PDF).&lt;br /&gt;&lt;br /&gt;At the top of ~/avrduderc, I needed:&lt;br /&gt;&lt;br /&gt;default_programmer = "dragon_hvsp";&lt;br /&gt;default_parallel   = "usb";&lt;br /&gt;&lt;br /&gt;(and removed the stuff from the Makefile(s) - these are just the parameters to -c and -p ).&lt;br /&gt;&lt;br /&gt;Update: Wonderful!  I wish I knew about it earlier.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_F0DRJg2NK8o/SwnT5w-iZbI/AAAAAAAAAdQ/XonaH9YAyIk/s1600/100_0515.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_F0DRJg2NK8o/SwnT5w-iZbI/AAAAAAAAAdQ/XonaH9YAyIk/s320/100_0515.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5407085816988198322" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It took a few tries, but I have an MCP4725 (i2c D/A) to a meter going offscreen working - read the ADXL345, write the MCP4725.&lt;br /&gt;&lt;br /&gt;Instead of using the clip (to the upper ATtiny85 - with the ceramic resonator), I just popped another t85 into the dragon, did HVSP, and swapped.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-477292774500025429?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/477292774500025429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/avr-dragon-tamed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/477292774500025429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/477292774500025429'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/avr-dragon-tamed.html' title='The (AVR) Dragon, tamed.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_F0DRJg2NK8o/SwnTkCVXQyI/AAAAAAAAAdI/_ywoQSi9fP8/s72-c/100_0514.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8183716757802474770</id><published>2009-11-20T19:42:00.001-08:00</published><updated>2009-11-20T19:42:42.571-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr attiny i2c adxl345 macro assembler'/><title type='text'>I2C in assembly</title><content type='html'>Closing in.  Still at 10Mhz. The I2C section is now in assembler.&lt;br /&gt;&lt;br /&gt;Right now the paths are 15 clocks low, 9 high.&lt;br /&gt;&lt;br /&gt;The SCL pulse should be 6 clocks, but shows 9.  What is happening is I immediately check if the line went up, but here is enough capacitance that it takes longer than the time between the grounding driver is turned off and when the bit is checked the first time for it to be detected as high, so instead of 2 cycles, it takes 5 (rjmp back to the test again), then the 3 delay between.&lt;br /&gt;&lt;br /&gt;The other paths are optimized, but the longest one is on reading between the 8th bit and the pulse for the ACK/NAK since it has to store the byte, decrement the length, and use it to determine whether to ack or nak.  16 clocks.&lt;br /&gt;&lt;br /&gt;Looping back to the top and doing a restart of course takes longer.&lt;br /&gt;&lt;br /&gt;9+16 = 25 = 400kHz.  The other paths are 15, so I could add a NOP in places.&lt;br /&gt;&lt;br /&gt;I've moved the common things into macros.&lt;br /&gt;&lt;br /&gt;The updated archive is at http://www.zdez.org/tinyacc.tgz replacing the others.&lt;br /&gt;&lt;br /&gt;I still need to do an 8Mhz (non crystal version), add some more I2C devices, and do more substituting lots of consecutive NOPs with something more space efficient.  But the whole thing is around 600 bytes.  The I2C driver is 246 bytes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8183716757802474770?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8183716757802474770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/i2c-in-assembly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8183716757802474770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8183716757802474770'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/i2c-in-assembly.html' title='I2C in assembly'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-278221702820912402</id><published>2009-11-19T09:39:00.001-08:00</published><updated>2009-11-19T10:13:06.996-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr attiny dragon programming flashing avrdude'/><title type='text'>Enter the (AVR) Dragon</title><content type='html'>I've been wondering how hard it would be to use the high voltage serial programming mode.  On most AVRs there are lots of IO ports so it doesn't really matter.  But on the ATtinyX5 series, there are 6 port pins and one is reset, but reset is needed by the ordinary ISP.  And is shared by the debugwire.  So if you set this pin, you can't program it that way.&lt;br /&gt;&lt;br /&gt;But the HVSP mode is supported by the AVR Dragon programmer (I couldn't find any other programmer which did this I could just buy).&lt;br /&gt;&lt;br /&gt;By pulling the reset pin up to 12v, (with some other sequencing) it enters this special mode and otherwise just works.  And is supported by avrdude.&lt;br /&gt;&lt;br /&gt;So I should be able to have one more pin (which I need for another project).  If nothing else, to do serial input as well as output (which needs the crystal/resonator pins) and I2C.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-278221702820912402?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/278221702820912402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/enter-avr-dragon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/278221702820912402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/278221702820912402'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/enter-avr-dragon.html' title='Enter the (AVR) Dragon'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-120912565106350741</id><published>2009-11-18T16:39:00.000-08:00</published><updated>2009-11-18T16:46:17.766-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avr attiny i2c serial adxl345 accelerometer'/><title type='text'>tiny does ADXL, update</title><content type='html'>The code is at http://www.zdez.org/tinyacc.tgz and runs full speed sending out binary (5aa5, then X,Y,Z as bigendian 16 bit words).&lt;br /&gt;&lt;br /&gt;GPLv3, that which isn't scenes a faire.&lt;br /&gt;&lt;br /&gt;The updated version merges the message and length buffers.  So you have a length followed by length message bytes (first is always written, the rest are read or written depending on the LSBit of the first message byte).  Length=0 ends things.  See test.c for an example.&lt;br /&gt;&lt;br /&gt;Start / msg / reStart / msg... / Stop is like I described in the previous post.&lt;br /&gt;&lt;br /&gt;Now I need to see about an AVR Dragon so I can use high voltage serial programming so I can use the reset line as a port pin...&lt;br /&gt;&lt;br /&gt;(and figure out how to actually program the TSSOP8 verson).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-120912565106350741?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/120912565106350741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/tiny-does-adxl-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/120912565106350741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/120912565106350741'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/tiny-does-adxl-update.html' title='tiny does ADXL, update'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7503887251866313224</id><published>2009-11-17T17:47:00.000-08:00</published><updated>2009-11-17T19:14:06.571-08:00</updated><title type='text'>Rant: the great disconnect</title><content type='html'>Why are all connectors either huge or cumbersome?&lt;br /&gt;&lt;br /&gt;There are fine-pitch connectors for LCDs or touch screens which are hard to handle.&lt;br /&gt;&lt;br /&gt;Or 0.1 inch center which are larger than the ATtiny45XU20 (TSSOP8).  The 0.5 inch connectors which are similar are very tall.&lt;br /&gt;&lt;br /&gt;For Arduino Pros and breakout boards (without posts) I ended up getting Components Corp TP-105-40-XX from Bisco - breakaway 0.1 test points that act as a fairly low profile connector/clip/plug.  Think banana plug but just two wires that insert and hold and insure contact.&lt;br /&gt;&lt;br /&gt;But I'm working on really small components.  To program the above ATtiny, I don't want to leave the ADXL345 attached (5v v. 3v), but how to connect it?  Even something I could insert into a microsocket.  Either it doesn't exist or is buried where I can't find it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7503887251866313224?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7503887251866313224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/rant-great-disconnect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7503887251866313224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7503887251866313224'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/rant-great-disconnect.html' title='Rant: the great disconnect'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-1240367378050774386</id><published>2009-11-17T17:28:00.000-08:00</published><updated>2009-11-17T17:46:49.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='avrtiny adxl345 megabaud'/><title type='text'>Tiny does the ADXL345 at top speed.</title><content type='html'>The bad news: the optimizer in avr-gcc is overzealous.&lt;br /&gt;&lt;br /&gt;The good news: Not so much that I couldn't get my current project working.&lt;br /&gt;&lt;br /&gt;I took the megabaud driver, and merged it with an updated "fixed" and optimized (-Os) I2C driver.  The result?  3.2kHz+ sampling rate in 3 axes on the ADXL345.&lt;br /&gt;&lt;br /&gt;I am running somewhat over 400kHz (The I2C spec says it has to remain high for 0.6 microseconds, low for 1.3, but overall 2.5.  What to do with the remaining 0.6?  I didn't quite use it all).&lt;br /&gt;&lt;br /&gt;I will post something shortly, but the core driver works with -Os, but the main program doesn't - it doesn't reset the DDR/PORT register to do an input/pullup at the end so I get break/noise.&lt;br /&gt;&lt;br /&gt;How it works:&lt;br /&gt;&lt;br /&gt;I merged everything so that I send in a messages buffer and lengths buffer.  The latter is the length of each message segment (separated by what becomes a repeated start instead of a stop then start).  The ending length is zero.  Reads set the message bytes, Writes read from the message bytes.&lt;br /&gt;&lt;br /&gt;The start condition is sent, then it enters the write loop - a do {} while since even reads need to send an address.  It exits if it isn't writing, or it has sent LEN bytes.  That is followed by the read loop, so if there are bytes left, it does the direction switch and loops reading, NAKing the final received byte to end the transfer.  If the next length is zero, it sends a stop.  Otherwise it does a repeated start.&lt;br /&gt;&lt;br /&gt;So the initial setup commands are sent as a block.  Then the Read FIFO number of samples ( send regno, read val, 4 bytes) as a block.  Then loop reading groups of 6 bytes (send regno, read val, 9 bytes), followed by sending them out PB1 using my 2Mbaud routine.  The lines are pulled up by external resistors so I just set DDR to input so it doesn't see the shifting bits.  Blocks are read until the FIFO count is exhausted, where it reads the next FIFO value.&lt;br /&gt;&lt;br /&gt;When I clean it up and take some pictures I'll post them.&lt;br /&gt;&lt;br /&gt;I'm using my pomona clip to program them using a second resonator on the board.  I should try it on the clip attachment, so it wouldn't matter what the fuses are.&lt;br /&gt;&lt;br /&gt;But I really need to figure out high voltage serial programming (or find something that will do it).  That way I can use the reset pin - which is 17% of the IO!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-1240367378050774386?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/1240367378050774386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/tiny-does-adxl345-at-top-speed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1240367378050774386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/1240367378050774386'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/tiny-does-adxl345-at-top-speed.html' title='Tiny does the ADXL345 at top speed.'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3843486711118365645</id><published>2009-11-14T08:06:00.000-08:00</published><updated>2009-11-14T08:38:19.611-08:00</updated><title type='text'>Cliq-ing, and a very tiny to accelerometer</title><content type='html'>I haven't been posting because I got a Motorola Cliq (as part of a giveaway from my attending the Moto/Android Developers conference) and have been playing with it.&lt;br /&gt;&lt;br /&gt;It appears to require a T-Mobile data service SIM (which I was able to borrow) to get the Blur part registered (and it won't let you do anything until that is done).  Afterward, it can do everything via wifi.  It won't recognize a T-mobile prepaid SIM for voice.&lt;br /&gt;&lt;br /&gt;But it is a very nice device.  I will be trying Ustream and/or Qik on my motorcycle this weekend.  The only problem is there is no link (nor root, at least not yet), and it is Android 1.5/1.6, not 2.0 like the new Droid.  (It has bluetooth, but only for things like handsfree).&lt;br /&gt;&lt;br /&gt;Meanwhile, I found Digikey has the ATTiny45 in a TSSOP-8 package.  A very tiny tiny.  I'm already talking to the ADXL345 using my ATtiny85, so this will make a very small unit.&lt;br /&gt;&lt;br /&gt;Getting I2C working was painful.  There is at least one bug in Atmel's AVR311 appnote code, it is complex, and everything is #defined so it can use any port/pin for the various models of the processor.  I rewrote it based on their code, though T2/T4 is hard coded for fast (400Hz).&lt;br /&gt;&lt;br /&gt;http://www.zdez.org/tinyacc.tgz has the archive (GPL - needs a 10Mhz crystal for the 2Mbaud, uses the Atmel PB2/PB0 for I2C, with PB1 for the serial).  It runs at just over 800Hz, mainly because I'm outputting hex codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3843486711118365645?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3843486711118365645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/cliq-ing-and-very-tiny-to-accelerometer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3843486711118365645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3843486711118365645'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/cliq-ing-and-very-tiny-to-accelerometer.html' title='Cliq-ing, and a very tiny to accelerometer'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-280448154394597742</id><published>2009-11-06T21:10:00.000-08:00</published><updated>2009-11-06T21:20:40.155-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny uart serial megabaud'/><title type='text'>Megabaud I/O</title><content type='html'>I wanted to do PB5, but then programming requires high voltage mode, so I did PB0 for RxI for now (with PB1 for TxD).  I need two pins for the crystal.&lt;br /&gt;&lt;br /&gt;(Note: an earlier test showed it was sending at 135k bytes per second for output going into my FTDI breakout from sparkfun).&lt;br /&gt;&lt;br /&gt;Sending 100000 'U' characters returned the following number of hex values:&lt;br /&gt;     17 40 @&lt;br /&gt;    886 50 P&lt;br /&gt;   1197 54 T&lt;br /&gt;  97900 55 U&lt;br /&gt;&lt;br /&gt;2.1% error, for a 5 bit width.  Could be better but still useful.  Or it could be the breadboard.  With ECC or just CRCs and retries it should work (though at the end I would need to jump back to the start after doing a store to autoinc).&lt;br /&gt;&lt;br /&gt;Update in http://www.zdez.org/tinymegabaud.tgz&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-280448154394597742?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/280448154394597742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/megabaud-io.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/280448154394597742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/280448154394597742'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/megabaud-io.html' title='Megabaud I/O'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-8629094486885411964</id><published>2009-11-05T09:28:00.000-08:00</published><updated>2009-11-05T09:57:03.034-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu karmic grub2 x upgrade boot linux polkit-1 swap'/><title type='text'>Kursed Karmic</title><content type='html'>While I've been doing other things I've been upgrading my main active&lt;br /&gt;backup USB image (a 16Gb micro SDHC card in USB and/or SD adapter)&lt;br /&gt;from Ubuntu Jaunty to Karmic, as well as a few other computers.&lt;br /&gt;&lt;br /&gt;As usual, the upgrade has been horrible.  But Koalas tend to just stay&lt;br /&gt;up in the trees and eat eucalyptis until they are high in another way&lt;br /&gt;all the time.  Which perhaps explains this release.&lt;br /&gt;&lt;br /&gt;The upgrade/install annoyances:&lt;br /&gt;&lt;br /&gt;1. When it doesn't like something - I had a bad sector on the media,&lt;br /&gt;   or some package was out of sync, or thinks it doesn't have enough&lt;br /&gt;   room, it will complain and exit instead of letting you retry EVEN&lt;br /&gt;   IF IT TAKES 20 MINUTES EACH TIME TO GET BACK TO WHERE IT STOPPED.&lt;br /&gt;&lt;br /&gt;2. Someone at canonical please tell the people setting up the upgrade&lt;br /&gt;   that networks can go down and need to be retried.  Halfway through&lt;br /&gt;   one upgrade the network died and left the system completely&lt;br /&gt;   unstable - half of the upgrades were there, but it couldn't go back&lt;br /&gt;   but it also couldn't complete (except manually, "apt-get&lt;br /&gt;   dist-upgrade" seemed to work).  DOWNLOAD ALL THE PACKAGES AND THEN&lt;br /&gt;   DECLARE A POINT OF NO RETURN OR ALLOW A RESUME.&lt;br /&gt;&lt;br /&gt;3. Even though I burn a CD or DVD, it insists on having network access&lt;br /&gt;   (perhaps because the universe/multiverse need to be upgraded).&lt;br /&gt;   This is stupid.  I should be able to get past the first reboot&lt;br /&gt;   without having network access, and that should allow me to connect&lt;br /&gt;   if I choose, or there should be a way of creating multiverse&lt;br /&gt;   packaga DVDs.&lt;br /&gt;&lt;br /&gt;4. After rebooting the first time into Karmic it is nice to know some&lt;br /&gt;   things never change.  The first is the network deadlock.  In order&lt;br /&gt;   to do some (restricted) hardware, it needs to download the drivers&lt;br /&gt;   from the internet.  It can only detect such hardware on the system&lt;br /&gt;   it is running on and will not cache these.  But if the network&lt;br /&gt;   ports are the devices needing the hardware, how can it ever come&lt;br /&gt;   up?  Having various spare USB devices with suppored drivers helps,&lt;br /&gt;   but this is REALLY STUPID.  To make it work all I have to do is&lt;br /&gt;   download the driver, but I don't have network access until I&lt;br /&gt;   download the driver.  They need a cache installed from the CD by&lt;br /&gt;   default with all NETWORK hardware not installed by default.  You&lt;br /&gt;   can also use the CD if you installed that way or burn one.&lt;br /&gt;&lt;br /&gt;5. It is also not nice to see things don't change like the stupid&lt;br /&gt;   Gnome Network Manager that takes minutes to discover the AP I just&lt;br /&gt;   turned on and has sent out beacons so that iwlist scan shows it&lt;br /&gt;   immediately.  Something which might make it slightly faster is&lt;br /&gt;   promised for "zippy zebra", but I suggested they add a button that&lt;br /&gt;   does what I have to do in 2 steps - disable then reenable wireless.&lt;br /&gt;&lt;br /&gt;6. Including beta software is usually a mistake, and worse in&lt;br /&gt;   something like the boot manager.  Unwelcome to grub2.  Actually the&lt;br /&gt;   boot process works extremely well, but there is almost NO&lt;br /&gt;   documentation at any official site, there is a good set at another&lt;br /&gt;   place http://members.iinet.net/~herman546/p20.html covering all the&lt;br /&gt;   CLI commands, but it has gaps.  But the worst thing is the support&lt;br /&gt;   utilities are badly broken.  They have something which scans for&lt;br /&gt;   other operating systems on anything which might be attached and&lt;br /&gt;   adds them to the menu whether you want it to or not.  With a&lt;br /&gt;   movable key this is a big problem.  Also it is completely incapable&lt;br /&gt;   of finding DOS boots (like where I run spinrite).  And it gets&lt;br /&gt;   confused with post boot v.s. bios enumeration, so it might be (hd1)&lt;br /&gt;   after boot, but (hd0) when it is active.  The UUID stuff does work&lt;br /&gt;   and helps and would be wonderful if the rest of grub2 would find&lt;br /&gt;   and use it properly.&lt;br /&gt;&lt;br /&gt;   To get DOS:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# from the first partition on the first BIOS disk:&lt;br /&gt;menuentry "DOS (on C:\)" {&lt;br /&gt;        chainloader (hd0,1)+1&lt;br /&gt;}&lt;br /&gt;# use "blkid" to find the DOS partition and replace UUID-UUID&lt;br /&gt;# with the actual value given&lt;br /&gt;menuentry "DOS (via UUID)" {&lt;br /&gt;        search --no-floppy --fs-uuid --set UUID-UUID&lt;br /&gt;        chainloader +1&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;6. There needs to be a non-eye-candy setting somewhere.  Right now I&lt;br /&gt;   have to neuter it at several places.  I do want to see the console&lt;br /&gt;   messages, but even more don't want a multimedia extravaganza.  A&lt;br /&gt;   graphic "starting X" that doesn't induce epilepsy would be ok.&lt;br /&gt;&lt;br /&gt;7. Related, I usually set the finest fonts possible so I can edit&lt;br /&gt;   using consoles and/or see 50-100 lines of messages instead of 25.&lt;br /&gt;   It used to be vga=extended on the kernel command line (and&lt;br /&gt;   something in initrd to duplicate or at least not change back, then&lt;br /&gt;   the post-boot option).  With a full graphic console I get higher&lt;br /&gt;   resolution, but with big fonts.  console-tools / console-utilities&lt;br /&gt;   using Cyr_a8x8 gives me 160x100 on my older laptop, but the kernel&lt;br /&gt;   still boots in big VGA, and initrd isn't switching though has a lot&lt;br /&gt;   of junk which is there to do that.&lt;br /&gt;&lt;br /&gt;8. And another switch which they don't document how to undo is&lt;br /&gt;   policykit-1.  It kept asking me for authorization every time I&lt;br /&gt;   wanted to mount a disk.  And the dialog box is supposed to do&lt;br /&gt;   something if I click on a link saying where/what is requiring the&lt;br /&gt;   authorization, but that is broken  I found in /usr/share/polkit-1&lt;br /&gt;   there is an actions directory that has files with XML so changing&lt;br /&gt;   all the allow tags to "yes" gets rid of this, but this is also&lt;br /&gt;   broken and badly documented.  Whatever is supposed to popup to let&lt;br /&gt;   me permanently change the settings from the dialog box is missing&lt;br /&gt;   and I have no way of guessing what it might be, existing things&lt;br /&gt;   don't work on these files, and there is no quick howto about using&lt;br /&gt;   alocal file.  I finally found some manpages for policykit but not a&lt;br /&gt;   lot of detail on how it is used across the various bits in ubuntu -&lt;br /&gt;   like having a Python guidebook isn't helpful figuring out the&lt;br /&gt;   upgrader.&lt;br /&gt;&lt;br /&gt;9. X has gotten 2x slower, at least in 3d fps (stellarium).  I don't&lt;br /&gt;   know why since the drivers are open.  Also the "don't zap" seems&lt;br /&gt;   not to be overridable (sometimes for run-aways or other hiccups it&lt;br /&gt;   is easier to do that than to logout).  But I was able to override&lt;br /&gt;   for my larger frame-buffer size.  xrandr seems to be in a package&lt;br /&gt;   (My netbook sometimes needs a bigger virtual screen).  They need&lt;br /&gt;   some way of easily and manually (though GUI or utility, not "sudo&lt;br /&gt;   vim /etc/X11/xorg.conf" overriding X features.&lt;br /&gt;&lt;br /&gt;10. tzdata-java and tzdata are out of sync preventing me from&lt;br /&gt;    installing java unless I downgrade (a really annoying manual&lt;br /&gt;    process since I have to find the old version, download it, and use&lt;br /&gt;    dpkg to install the older tzdata).  Something is wrong in that the&lt;br /&gt;    dependencies go both ways and they shouldn't have updated/upgraded&lt;br /&gt;    tzdata without tzdata-java (and "held back" isn't a good mechanism&lt;br /&gt;    since it only works with things which are installed).  This bit me&lt;br /&gt;    on Karmic but has been a problem since Gutsy where tzdata will get&lt;br /&gt;    ahead of the java version, and the dependency is marked as exact&lt;br /&gt;    instead of greater than or equal to.&lt;br /&gt;&lt;br /&gt;11. I did install it new, but didn't want to repartition.  The evil&lt;br /&gt;    partitioner will NOT indicate it will reformat swap space and/or use&lt;br /&gt;    that swap space - you need to select it and choose and any change&lt;br /&gt;    will NOT be visible.  So if you get to the final screen, you have to&lt;br /&gt;    go back and restart the process.  I have a bug report in - there is&lt;br /&gt;    no reason not to check the "format" box if they are going to format.&lt;br /&gt;    There might not be a mount point but they should say "(swap)" if it&lt;br /&gt;    is going to be used as swap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-8629094486885411964?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/8629094486885411964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/kursed-karmic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8629094486885411964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/8629094486885411964'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/kursed-karmic.html' title='Kursed Karmic'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-2120670640481252558</id><published>2009-11-04T22:20:00.000-08:00</published><updated>2009-11-05T06:53:50.173-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny uart serial'/><title type='text'>ATtiny85 2 Megabaud Output only</title><content type='html'>Updated!  Cleaned up and now as a function.&lt;br /&gt;&lt;br /&gt;At 3.3v I can only safely do 10Mhz, for which I have a ceramic resonator (and you need to set the fuses appropriately).&lt;br /&gt;&lt;br /&gt;I also have a 3.3v FTDI breakout from sparkfun so I can connect ground, 3.3v, and RXI.&lt;br /&gt;&lt;br /&gt;At 2 megabaud, a character takes 5 microseconds, and interrupts can often be disabled for this long to prevent hiccups.  High throughput is also nice, but mainly because the ATTiny doesn't have a built-in UART, I don't want to bit-bang or eat a timer, or have to worry about the latency or load.  I can blip out a few bytes when I need to.&lt;br /&gt;&lt;br /&gt;http://www.zdez.org/tinymegabaud.tgz&lt;br /&gt;&lt;br /&gt;Since I'm not sure about GCC/avr/as syntax, I cheated and wrote a quick C program and edited the assembly.&lt;br /&gt;&lt;br /&gt;It will be incorporated into a few projects shortly, but some might find the proof of concept useful.&lt;br /&gt;&lt;br /&gt;I don't disable interrupts but that would need to be done if interrupts are used in the larger project&lt;br /&gt;&lt;br /&gt;(one thing is I now can sample other bits at a high rate and send them, or just do printf debugging)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;tt&gt;&lt;br /&gt; .file "sendchar.S"&lt;br /&gt;__tmp_reg__ = 0&lt;br /&gt;__zero_reg__ = 1&lt;br /&gt; .global __do_copy_data&lt;br /&gt; .global __do_clear_bss&lt;br /&gt; .text&lt;br /&gt;.global sendchar&lt;br /&gt; .type send, @function&lt;br /&gt;sendchar:&lt;br /&gt;        cli             // No Interrupts during send&lt;br /&gt;        out 24,__zero_reg__     // Send start bit&lt;br /&gt; ldi r25,9       // 8 data plus stop&lt;br /&gt;        sec             // set carry for stop&lt;br /&gt;        sec             // nop - one more cycle&lt;br /&gt;.L2:&lt;br /&gt; out 24,r24      // send bit out PB0&lt;br /&gt; ror r24         // set next bit&lt;br /&gt;        dec r25         // repeat N bits&lt;br /&gt; brne .L2&lt;br /&gt;        sei             // reenable interrupts (really should save/restore)&lt;br /&gt;        ret&lt;br /&gt; .size send, .-send&lt;br /&gt;===========================================&lt;br /&gt;#include &amp;lt;avr/io.h&gt;&lt;br /&gt;extern void sendchar(unsigned char c);&lt;br /&gt;char test[]="Megabaud Tiny\r\n";&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;    DDRB = 1;&lt;br /&gt;    PORTB = 1;&lt;br /&gt;    for(;;) {&lt;br /&gt;        char *c = test;&lt;br /&gt;        while( *c )&lt;br /&gt;            sendchar(*c++);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/tt&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-2120670640481252558?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/2120670640481252558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/attiny85-2-megabaud.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2120670640481252558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/2120670640481252558'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/attiny85-2-megabaud.html' title='ATtiny85 2 Megabaud Output only'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-4958366705502049839</id><published>2009-11-01T20:56:00.000-08:00</published><updated>2009-11-01T21:07:26.484-08:00</updated><title type='text'>Different colors for K and Ka band beeps</title><content type='html'>Patch at bottom.&lt;br /&gt;&lt;br /&gt;The staccato used to split K and Ka is actually fairly easy to add, though it will be wrong for the first fraction of a second.&lt;br /&gt;&lt;br /&gt;If the beep is the short/split staccato, it will show orange to indicate Ka, otherwise blue-green for K.  The "brap" is 4 cycles of the X band followed by 4 cycles of a very short waveform (about 1/4 of X).  The K band signal is 13 of these groups, the Ka is 9, a 1/50th of a second gap (which isn't visually perceptable), then another 9 cycles.&lt;br /&gt;&lt;br /&gt;So there will be 36 cycles of the short wave for Ka, 52 for K.  I count and set a flag.  The NEXT group will be the color based on the flag.  I was out testing and it works.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;tt&gt;&lt;br /&gt;--- visione.bak 2009-11-01 19:24:01.000000000 -0800&lt;br /&gt;+++ visione.c 2009-11-01 20:54:36.000000000 -0800&lt;br /&gt;@@ -6,11 +6,17 @@&lt;br /&gt; #define PCHGI 4&lt;br /&gt; &lt;br /&gt; unsigned char lowtime;&lt;br /&gt;+int beepcount = 0;&lt;br /&gt;+int kaflag = 0;&lt;br /&gt;+#define BEEPS 40&lt;br /&gt; &lt;br /&gt; ISR(TIMER1_OVF_vect)&lt;br /&gt; {&lt;br /&gt;-    PORTB = 0;;&lt;br /&gt;-    lowtime = 7;&lt;br /&gt;+    PORTB = 0;&lt;br /&gt;+    lowtime = 255;&lt;br /&gt;+    if( beepcount )&lt;br /&gt;+        kaflag = ( beepcount &amp;lt; BEEPS );&lt;br /&gt;+    beepcount = 0;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; ISR(PCINT0_vect)&lt;br /&gt;@@ -26,6 +32,9 @@&lt;br /&gt;     // long period, probably not beeping&lt;br /&gt;     if( lowtime &gt; 21*7 || this &gt; 21*7 ) {&lt;br /&gt;         PORTB = 0;&lt;br /&gt;+        if( beepcount )&lt;br /&gt;+            kaflag = ( beepcount &amp;lt; BEEPS );&lt;br /&gt;+        beepcount = 0;&lt;br /&gt;         return;&lt;br /&gt;     }&lt;br /&gt; #define RED 4&lt;br /&gt;@@ -33,7 +42,13 @@&lt;br /&gt; #define BLUE 1&lt;br /&gt;     if( lowtime &amp;lt; 21*2 ) {&lt;br /&gt;         // 126 294 460 microseconds&lt;br /&gt;-        PORTB = RED + GREEN; // Ka as Orange instead of red&lt;br /&gt;+        beepcount++;&lt;br /&gt;+        if( kaflag ) // maybe &amp;&amp; beepcount &lt; BEEPS&lt;br /&gt;+            PORTB = RED;&lt;br /&gt;+        else&lt;br /&gt;+            PORTB = BLUE;&lt;br /&gt;+&lt;br /&gt;+        //        PORTB = RED; + GREEN; // Ka as Orange instead of red&lt;br /&gt;         return;&lt;br /&gt;     }&lt;br /&gt;     if( lowtime &amp;lt; 21*4 ) {&lt;br /&gt;&lt;/tt&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-4958366705502049839?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/4958366705502049839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/different-colors-for-k-and-ka-band.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4958366705502049839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/4958366705502049839'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/11/different-colors-for-k-and-ka-band.html' title='Different colors for K and Ka band beeps'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3057649964996860329</id><published>2009-10-26T21:02:00.000-07:00</published><updated>2009-10-26T21:19:03.849-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='v1 radar detector attiny'/><title type='text'>Working Prototype Visual Beep</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuZzwPjz4II/AAAAAAAAAbU/7JEnKllIPZ4/s1600-h/100_0495.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuZzwPjz4II/AAAAAAAAAbU/7JEnKllIPZ4/s320/100_0495.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5397128476097765506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm using the pomona connector to do the upload of the code.&lt;br /&gt;&lt;br /&gt;Current version:&lt;br /&gt;&lt;br /&gt;http://www.zdez.org/tinyvisbeep.tgz&lt;br /&gt;&lt;br /&gt;The colors have changed slightly - X band = Green, K/Ka yellow, Laser: Red/Green alternate, Bogey++: Blue, Junk: blue-red-green.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3057649964996860329?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3057649964996860329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/working-prototype-visual-beep.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3057649964996860329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3057649964996860329'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/working-prototype-visual-beep.html' title='Working Prototype Visual Beep'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_F0DRJg2NK8o/SuZzwPjz4II/AAAAAAAAAbU/7JEnKllIPZ4/s72-c/100_0495.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3209486799789836118</id><published>2009-10-24T21:04:00.000-07:00</published><updated>2009-10-24T21:22:59.187-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny led V1 Radar detector'/><title type='text'>AVRtiny85 Valentine V1 Beep to LED conversion</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_F0DRJg2NK8o/SuPOqbskOcI/AAAAAAAAAbE/EJ0rsRfhwYk/s1600-h/00002.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_F0DRJg2NK8o/SuPOqbskOcI/AAAAAAAAAbE/EJ0rsRfhwYk/s320/00002.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5396384006904494530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuPOqEw6BxI/AAAAAAAAAa8/sN-MwLcEASc/s1600-h/00001.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuPOqEw6BxI/AAAAAAAAAa8/sN-MwLcEASc/s320/00001.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5396384000748685074" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The LED is http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=425-2722-1-ND&lt;br /&gt;1.6 millimeter square.&lt;br /&gt;&lt;br /&gt;Those go through some resistors to balance the color and limit the current.  The LED is VERY bright.  I will need to add something for a dimming function.&lt;br /&gt;&lt;br /&gt;The V1 has four basic tones (one is a combination for the Ka Braap alert).  The waveforms are rail to rail based on a 12Khz clock, so counting the number of 84 microsecond ticks (4uS * 21) gives a series of numbers from 1-6.  Anything longer should turn off the LED.&lt;br /&gt;&lt;br /&gt;Current (preliminary) Source:&lt;br /&gt;http://www.zdez.org/v1beep2led.c&lt;br /&gt;Fuses need to be 0xe2 for lfuse, 0xdd for hfuse&lt;br /&gt;&lt;br /&gt;There are standard beeps for the V1, and this is how it shows up&lt;br /&gt;X will show green.&lt;br /&gt;K/Ka will show yellow (Ka has a gap/flash)&lt;br /&gt;Laser alternates red/green&lt;br /&gt;One-More contact flashes blue twice&lt;br /&gt;Junk (alert canceled) will be blue-red-green&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3209486799789836118?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3209486799789836118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/avrtiny85-valentine-v1-beep-to-led.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3209486799789836118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3209486799789836118'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/avrtiny85-valentine-v1-beep-to-led.html' title='AVRtiny85 Valentine V1 Beep to LED conversion'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_F0DRJg2NK8o/SuPOqbskOcI/AAAAAAAAAbE/EJ0rsRfhwYk/s72-c/00002.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-7208751518165015887</id><published>2009-10-23T19:22:00.000-07:00</published><updated>2009-10-23T19:34:57.703-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attiny connector avr isp programming'/><title type='text'>ATtiny clip programming</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuJlldnKjJI/AAAAAAAAAac/-yrsTUBUPh8/s1600-h/100_0480.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_F0DRJg2NK8o/SuJlldnKjJI/AAAAAAAAAac/-yrsTUBUPh8/s320/100_0480.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5395986997821738130" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One annoyance is many boards waste space with ISP connectors.&lt;br /&gt;&lt;br /&gt;The alternative is to use dip-clips or soic clips:&lt;br /&gt;&lt;br /&gt;http://www.mouser.com/Search/ProductDetail.aspx?R=5208virtualkey56520000virtualkey565-5208&lt;br /&gt;http://www.mouser.com/Search/ProductDetail.aspx?R=5250virtualkey56520000virtualkey565-5250&lt;br /&gt;&lt;br /&gt;They are about $10 each, and require you to get some female break-away headers if you want to do it like I did, but you don't need to the onboard connector.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-7208751518165015887?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/7208751518165015887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/attiny-clip-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7208751518165015887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/7208751518165015887'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/attiny-clip-programming.html' title='ATtiny clip programming'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_F0DRJg2NK8o/SuJlldnKjJI/AAAAAAAAAac/-yrsTUBUPh8/s72-c/100_0480.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-9054727613311356693</id><published>2009-10-23T12:26:00.000-07:00</published><updated>2009-10-23T21:25:59.536-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='embedded arduino bluetooth programming'/><title type='text'>Bluetooth Arduino programming and more race</title><content type='html'>Two quick notes - I had an arduino fail (given the amount of abuse in the prototyping it was not surprising but was annoying).&lt;br /&gt;&lt;br /&gt;So while I'm replacing it I decided to try flashing via bluetooth using the same Parani (www.sena.com) module I'm using with a wire shift.  It worked fine though the display update was less smooth (I think the BT uses bigger buffers than USB).&lt;br /&gt;&lt;br /&gt;Also I found a race condition with the fixed race condition - I need to save a local copy of rxmrk, process the line to that point, then update rxmrk to the saved point.  If I don't, when a second "push" character comes in (like a linefeed following a carriage return), it can be ignored.&lt;br /&gt;&lt;br /&gt;So my weekend project will be to get this working again (and I've decided to drop the accelerometer, at least until I can get it to return data and not just random vibrations).&lt;br /&gt;&lt;br /&gt;Update:&lt;br /&gt;http://www.zdez.org/j1850.c - current version, accelerometer support removed&lt;br /&gt;http://www.zdez.org/j1850acc.c - old version with accelerometer&lt;br /&gt;http://www.zdez.org/getephem.sh - download Eph.dat from skytraq&lt;br /&gt;http://www.zdez.org/agpsup.c - send Eph.dat to venus&lt;br /&gt;&lt;br /&gt;I reconstructed the unit with a new arduino, and while I was there put in the switch.  In the default position I can use agpsup.c to send the AGPS data to the Venus GPS.  In the other, I can use avrdude to reprogram the arduino.&lt;br /&gt;&lt;br /&gt;Basically it is a parani module from Sena with Tx going to the Venus module and the alternate pin on the switch, the Rx to the sena module from the Tx on the arduino, the Rx on the arduino to the switch which defaults to the Tx from the Venus (and the arduino acts as a passthrough).  Without V1 or J1850 traffic it just acts transparent to/from the venus.  And currently the Venus doesn't seem to ming the arduino programming (though I would need to be careful if I start putting venus config strings in the arduino).&lt;br /&gt;&lt;br /&gt;D8 is for j1850 (IC1), and D9 is for the V1 (PCINT)..&lt;br /&gt;&lt;br /&gt;A note on the SkyTraq/Venus AGPS - it really needs to know the time, so even with AGPS it will take a long time to cold start unless you send it the current UTC (or something close), or it finds one satellite.  After that it is fast.&lt;br /&gt;&lt;br /&gt;(I added the diode and battery specified in the venus datasheet (both are available from digi-key) to the Venus breakout, though without the recommended series resistor).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-9054727613311356693?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/9054727613311356693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/bluetooth-arduino-programming-and-more.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/9054727613311356693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/9054727613311356693'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/bluetooth-arduino-programming-and-more.html' title='Bluetooth Arduino programming and more race'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6388203843073594887.post-3209185454925253016</id><published>2009-10-21T21:20:00.000-07:00</published><updated>2009-10-21T21:27:24.395-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='teensy timing input capture usb atmel avr acm'/><title type='text'>Teensy timing</title><content type='html'>I've been playing with a USB based arduino-like system called the Teensy&lt;br /&gt;&lt;br /&gt;http://pjrc.com/teensy/index.html&lt;br /&gt;&lt;br /&gt;Cool thing is both have two input captures.  They will also run independent of the USB and the 2.0 can be set to 3.3v by adding the regulator and changing a solder jumper.&lt;br /&gt;&lt;br /&gt;Serial is cdc_acm based and should allow much faster speeds.&lt;br /&gt;&lt;br /&gt;http://pjrc.com/teensy/usb_serial.html&lt;br /&gt;&lt;br /&gt;So I hacked the timing code from the Mega into the teensy and it seems to work fine, though in this case I have to give an III (I followed by any two letters) to enable it.  It probably could be enabled from the start, but I'm still experimenting.&lt;br /&gt;&lt;br /&gt;Here is the patch (oops - reversed) to example.c:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;tt&gt;&lt;br /&gt;--- example.c 2009-10-21 20:23:49.000000000 -0700&lt;br /&gt;+++ orig/example.c 2009-07-06 03:33:52.000000000 -0700&lt;br /&gt;@@ -21,9 +21,6 @@&lt;br /&gt;  * THE SOFTWARE.&lt;br /&gt;  */&lt;br /&gt; &lt;br /&gt;-#include &amp;lt;avr/interrupt.h&gt;&lt;br /&gt;-#include &amp;lt;avr/sleep.h&gt;&lt;br /&gt;-&lt;br /&gt; #include &amp;lt;avr/io.h&gt;&lt;br /&gt; #include &amp;lt;avr/pgmspace.h&gt;&lt;br /&gt; #include &amp;lt;stdint.h&gt;&lt;br /&gt;@@ -39,91 +36,6 @@&lt;br /&gt; uint8_t recv_str(char *buf, uint8_t size);&lt;br /&gt; void parse_and_execute_command(const char *buf, uint8_t num);&lt;br /&gt; &lt;br /&gt;-&lt;br /&gt;-unsigned char hobuf[20] = "x";&lt;br /&gt;-unsigned long ltens[12];&lt;br /&gt;-static void widthout(unsigned char polarity, unsigned long width)&lt;br /&gt;-{&lt;br /&gt;-    unsigned char *h = hobuf, i,j;&lt;br /&gt;-    *h++ = polarity &amp; 1 ? '1' : '3';&lt;br /&gt;-    *h++ = polarity &amp; 0xc0 ? '/' : '\\';&lt;br /&gt;-    i = 1;&lt;br /&gt;-    while( ltens[i] &amp;lt; width )&lt;br /&gt;-        i++;&lt;br /&gt;-    while( i-- ) {&lt;br /&gt;-        j = '0';&lt;br /&gt;-        while( width &gt;= ltens[i] ) {&lt;br /&gt;-            width -= ltens[i];&lt;br /&gt;-            j++;&lt;br /&gt;-        }&lt;br /&gt;-        *h++ = j;&lt;br /&gt;-    }&lt;br /&gt;-&lt;br /&gt;-    if( 1 || polarity &amp; 0xc0 ) {&lt;br /&gt;-        *h++ = '\r';&lt;br /&gt;-        *h++ = '\n';&lt;br /&gt;-    }&lt;br /&gt;-&lt;br /&gt;-    *h++ = 0;&lt;br /&gt;-&lt;br /&gt;-    h = hobuf;&lt;br /&gt;-    while( *h ) &lt;br /&gt;-        usb_serial_putchar(*h++);&lt;br /&gt;-    &lt;br /&gt;-    //txenqueue(hobuf, h - hobuf);&lt;br /&gt;-}&lt;br /&gt;-&lt;br /&gt;-static unsigned char toggle1 = 1, toggle3 = 1;&lt;br /&gt;-static unsigned long hitime1, hitime3, lastedge1, lastedge3;&lt;br /&gt;-ISR(TIMER1_CAPT_vect)&lt;br /&gt;-{&lt;br /&gt;-    unsigned long counts;&lt;br /&gt;-    PORTD |= 0x40;&lt;br /&gt;-    if( toggle1 )&lt;br /&gt;-        TCCR1B ^= 0x40;&lt;br /&gt;-    counts = ICR1;&lt;br /&gt;-    counts += hitime1;&lt;br /&gt;-&lt;br /&gt;-    widthout(1 | (TCCR1B &amp; 0x40) ,  counts - lastedge1);&lt;br /&gt;-    lastedge1 = counts;&lt;br /&gt;-}&lt;br /&gt;-&lt;br /&gt;-ISR(TIMER3_CAPT_vect)&lt;br /&gt;-{&lt;br /&gt;-    unsigned long counts;&lt;br /&gt;-    PORTD &amp;= ~0x40;&lt;br /&gt;-    if( toggle3 )&lt;br /&gt;-        TCCR3B ^= 0x40;&lt;br /&gt;-    counts = ICR3;&lt;br /&gt;-    counts += hitime3;&lt;br /&gt;-&lt;br /&gt;-    widthout( TCCR3B &amp; 0x50 , counts - lastedge3);&lt;br /&gt;-    lastedge3 = counts;&lt;br /&gt;-}&lt;br /&gt;-&lt;br /&gt;-ISR(TIMER1_OVF_vect)&lt;br /&gt;-{&lt;br /&gt;-    hitime1 += 0x10000;&lt;br /&gt;-    hitime3 += 0x10000;&lt;br /&gt;-}&lt;br /&gt;-&lt;br /&gt;-void timer_init(void) {&lt;br /&gt;-    hitime1 = hitime3 = 0;&lt;br /&gt;-&lt;br /&gt;-    GTCCR = 0x81;&lt;br /&gt;-    TCCR1B = 0xC0 | 2;  // NoiseC, edge ...  off,1,8,64,236,1024,ext&lt;br /&gt;-    TCCR3B = 0x80 | 2; // NoiseC, edge ...  off,1,8,64,256,1024,ext&lt;br /&gt;-    // /8&lt;br /&gt;-    GTCCR = 0x80;&lt;br /&gt;-&lt;br /&gt;-    TIFR1 |= 0x21;              // reset interrupt triggers&lt;br /&gt;-    TIFR3 |= 0x21;              // reset interrupt triggers&lt;br /&gt;-    TIMSK1 |= 0x21;             // enable interrupt&lt;br /&gt;-    TIMSK3 |= 0x20;             // enable interrupt&lt;br /&gt;-&lt;br /&gt;-}&lt;br /&gt;-&lt;br /&gt;-&lt;br /&gt; #if 0&lt;br /&gt; // Very simple character echo test&lt;br /&gt; int main(void)&lt;br /&gt;@@ -156,18 +68,6 @@&lt;br /&gt;  usb_init();&lt;br /&gt;  while (!usb_configured()) /* wait */ ;&lt;br /&gt;  _delay_ms(1000);&lt;br /&gt;-        //timer_init();&lt;br /&gt;-    unsigned long lt = 1;&lt;br /&gt;-    unsigned char i;&lt;br /&gt;-&lt;br /&gt;-    for( i = 0 ; i &amp;lt; 12; i++ ) {&lt;br /&gt;-        ltens[i] = lt;&lt;br /&gt;-        // lt *= 10&lt;br /&gt;-        unsigned long lx = lt + lt;&lt;br /&gt;-        lx += lx;&lt;br /&gt;-        lt += lx;&lt;br /&gt;-        lt += lt;&lt;br /&gt;-    }&lt;br /&gt; &lt;br /&gt;  while (1) {&lt;br /&gt;   // wait for the user to run their terminal emulator program&lt;br /&gt;@@ -255,11 +155,6 @@&lt;br /&gt;   send_str(PSTR("unrecognized format, 3 chars min req'd\r\n"));&lt;br /&gt;   return;&lt;br /&gt;  }&lt;br /&gt;-        if(buf[0] == 'I') {&lt;br /&gt;-            timer_init();&lt;br /&gt;-            return;&lt;br /&gt;-        }&lt;br /&gt;-&lt;br /&gt;  // first character is the port letter&lt;br /&gt;  if (buf[0] &gt;= 'A' &amp;&amp; buf[0] &amp;lt;= 'F') {&lt;br /&gt;   port = buf[0] - 'A';&lt;br /&gt;&lt;br /&gt;&lt;/tt&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6388203843073594887-3209185454925253016?l=harleyhacking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://harleyhacking.blogspot.com/feeds/3209185454925253016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/teensy-timing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3209185454925253016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6388203843073594887/posts/default/3209185454925253016'/><link rel='alternate' type='text/html' href='http://harleyhacking.blogspot.com/2009/10/teensy-timing.html' title='Teensy timing'/><author><name>tz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_F0DRJg2NK8o/Ss1Hx9sb1cI/AAAAAAAAANs/4WtQjtj4hWU/S220/tzmin64x64.gif'/></author><thr:total>0</thr:total></entry></feed>
