<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hack a Day &#187; to-92</title>
	<atom:link href="http://hackaday.com/tag/to-92/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackaday.com</link>
	<description>Fresh hacks every day</description>
	<lastBuildDate>Fri, 10 Feb 2012 06:18:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hackaday.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5560f98f805877b0e332f191cb9e0af3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Hack a Day &#187; to-92</title>
		<link>http://hackaday.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hackaday.com/osd.xml" title="Hack a Day" />
	<atom:link rel='hub' href='http://hackaday.com/?pushpress=hub'/>
		<item>
		<title>Parts: 1K 1-Wire EEPROM (DS2431)</title>
		<link>http://hackaday.com/2008/12/24/parts-1k-1-wire-eeprom-ds2431/</link>
		<comments>http://hackaday.com/2008/12/24/parts-1k-1-wire-eeprom-ds2431/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 14:00:01 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[1-wire]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[eeprom]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[interfacing]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[serial interface]]></category>
		<category><![CDATA[to-92]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=6785</guid>
		<description><![CDATA[The Maxim DS2431 1K EEPROM is 1-Wire device that adds storage to a project using a single microcontroller pin. We previously interfaced a 1-wire thermometer, but this EEPROM is slightly different because it draws power directly from the 1-Wire bus. Grab the datasheet (PDF) and follow along while we read and write this simple 1-Wire [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=6785&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-7182" title="1keeprom-450" src="http://hackadaycom.files.wordpress.com/2008/12/1keeprom-450.jpg" alt="1keeprom-450" width="450" height="335" /></p>
<p>The Maxim <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4272">DS2431 1K EEPROM</a> is <a href="http://en.wikipedia.org/wiki/1-Wire">1-Wire</a> device that adds storage to a project using a single microcontroller pin. We previously interfaced a <a href="http://hackaday.com/2008/12/10/parts-1-wire-temperature-sensor-ds1822/">1-wire thermometer</a>, but this EEPROM is slightly different because it draws power directly from the 1-Wire bus. Grab the <a href="http://www.maxim-ic.com/getds.cfm/qv_pk/4272">datasheet</a> (PDF) and follow along while we read and write this simple 1-Wire memory.</p>
<p><span id="more-6785"></span></p>
<p><strong><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4272">DS2431</a> 1-Wire 1K EEPROM (Digikey #<a href="http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=DS2431%2B-ND">DS2431+-ND</a>, $1.67)</strong></p>
<p>We used our <a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface</a> to demonstrate the DS2431 EEPROM, we covered the proper connections and configuration options in <a href="http://hackaday.com/2008/12/10/parts-1-wire-temperature-sensor-ds1822/">our previous 1-wire post</a>. The DS2431 requires just two connections: ground (pin 1) and 1-Wire/power (pin 2).  Pin 3 remains unconnected. Like last time, we used a 2K pull-up resistor with the 1-Wire bus.</p>
<p>First, we use the Bus Pirate&#8217;s SEARCH ROM command to identify connected 1-Wire devices.</p>
<blockquote><p>1-WIRE&gt;(240) <strong>&lt;&#8211;SEARCH ROM command macro</strong><br />
1WIRE ROM COMMAND: SEARCH (0xF0)<br />
Found devices at:<br />
Macro     1-WIRE address<br />
1.0x2D 0&#215;54 0xD2 0xEF 0&#215;00 0&#215;00 0&#215;00 0x2B <strong>&lt;&#8211;address</strong><br />
*DS2431 1K EEPROM <strong>&lt;&#8211; type</strong><br />
2.0x2D 0xFE 0x8D 0&#215;43 0&#215;01 0&#215;00 0&#215;00 0&#215;52<br />
*DS2431 1K EEPROM<br />
3.0x2D 0x2B 0xED 0xEF 0&#215;00 0&#215;00 0&#215;00 0x7C<br />
*DS2431 1K EEPROM<br />
Found 0&#215;03 devices.<br />
The first 10 device IDs are available by MACRO, see (0).<br />
1-WIRE&gt;</p></blockquote>
<p>The SEARCH ROM command reveals that there are 3 EEPROMs connected to the 1-Wire bus. The Bus Pirate stores the 64bit 1-wire addresses in macros so we don&#8217;t have to type it every time. We&#8217;ll work with the first device, identified by macro (1).</p>
<p>Writing to the DS2431 takes three steps:</p>
<ul>
<li>Write data to DS2431&#8242;s 8byte &#8216;scratch pad&#8217; EEPROM buffer</li>
<li>Verify the scratch pad contents and get the write access key</li>
<li>Copy data from the scratch pad to the EEPROM for permanent storage.</li>
</ul>
<p>Command 0x0f writes to the scratch pad. The scratch pad is an 8byte buffer that holds data prior to saving it permanently in the EEPROM.</p>
<blockquote><p>1-WIRE&gt;(85)(1) 0x0f 0&#215;00 0&#215;00 0 1 2 3 4 5 6 7 <strong>&lt;&#8211;command</strong><br />
1WIRE BUS RESET OK<br />
1WIRE WRITE ROM COMMAND: MATCH (0&#215;55) *follow with 64bit address<br />
1WIRE ADDRESS MACRO 1: 0x2D 0&#215;54 0xD2 0xEF 0&#215;00 0&#215;00 0&#215;00 0x2B<br />
1WIRE WRITE: 0x0F <strong>&lt;&#8211;write to scratch pad</strong><br />
1WIRE WRITE: 0&#215;00 <strong>&lt;&#8211;begin address byte 1</strong><br />
1WIRE WRITE: 0&#215;00 <strong>&lt;&#8211;begin address byte 2</strong><br />
1WIRE WRITE: 0&#215;00 <strong>&lt;&#8211;data</strong><br />
1WIRE WRITE: 0&#215;01<br />
1WIRE WRITE: 0&#215;02<br />
1WIRE WRITE: 0&#215;03<br />
1WIRE WRITE: 0&#215;04<br />
1WIRE WRITE: 0&#215;05<br />
1WIRE WRITE: 0&#215;06<br />
1WIRE WRITE: 0&#215;07<br />
1-WIRE&gt;</p></blockquote>
<p>The MATCH ROM macro, (85), isolates the the first device, (1). 0x0f is the command to write to the scratch pad, followed by the start address, 0 0. Finally, we send eight bytes of data to save in the scratch pad. The scratch pad is eight bytes long, and all eight bytes will be copied from the scratch pad to the EEPROM at once.</p>
<blockquote><p>1-WIRE&gt;(85)(1) 0xaa r:3 r:8 r:2 r:2 <strong>&lt;&#8211;command</strong><br />
1WIRE BUS RESET OK<br />
1WIRE WRITE ROM COMMAND: MATCH (0&#215;55) *follow with 64bit address<br />
1WIRE ADDRESS MACRO 1: 0x2D 0&#215;54 0xD2 0xEF 0&#215;00 0&#215;00 0&#215;00 0x2B<br />
1WIRE WRITE: 0xAA <strong>&lt;&#8211;read scratch pad</strong><br />
1WIRE BULK READ, 0&#215;03 BYTES: <strong>&lt;&#8211;access code</strong><br />
0&#215;00 0&#215;00 0&#215;07<br />
1WIRE BULK READ, 0&#215;08 BYTES:<strong>&lt;&#8211;verify our data</strong><br />
0&#215;00 0&#215;01 0&#215;02 0&#215;03 0&#215;04 0&#215;05 0&#215;06 0&#215;07<br />
1WIRE BULK READ, 0&#215;02 BYTES:<strong>&lt;&#8211;inverse CRC</strong><br />
0&#215;44 0&#215;67<br />
1WIRE BULK READ, 0&#215;02 BYTES:<strong>&lt;&#8211;all 1s from here</strong><br />
0xFF 0xFF<br />
1-WIRE&gt;</p></blockquote>
<p>To copy data from the scratch pad to the EEPROM, we must first retrieve a three byte access code from the scratch pad with the command 0xaa.  The first three bytes are the access code (0&#215;00 0&#215;00 0&#215;07), followed by the data contained in the scratch pad.</p>
<blockquote><p>1-WIRE&gt;(85)(1) 0&#215;55 0&#215;00 0&#215;00 0&#215;07<br />
1WIRE BUS RESET OK<br />
1WIRE WRITE ROM COMMAND: MATCH (0&#215;55) *follow with 64bit address<br />
1WIRE ADDRESS MACRO 1: 0x2D 0&#215;54 0xD2 0xEF 0&#215;00 0&#215;00 0&#215;00 0x2B<br />
1WIRE WRITE: 0&#215;55 <strong>&lt;&#8211;copy to EEPROM command</strong><br />
1WIRE WRITE: 0&#215;00<strong>&lt;&#8211;access code (3 bytes)</strong><br />
1WIRE WRITE: 0&#215;00<br />
1WIRE WRITE: 0&#215;07<br />
1-WIRE&gt;!!!! <strong>&lt;&#8211;read bits</strong><br />
1WIRE READ BIT: 0<br />
1WIRE READ BIT: 1 <strong>&lt;&#8211;bits alternate, done</strong><br />
1WIRE READ BIT: 0<br />
1WIRE READ BIT: 1<br />
1-WIRE&gt;</p></blockquote>
<p>Command 0&#215;55 with the correct access code will copy the scratch pad to the data EEPROM. Bit reads (!!!!) alternate between 0 and 1 when the copy completes.</p>
<blockquote><p>1-WIRE&gt;(85)(1) 0xf0 0&#215;00 0&#215;00 r:8 r:8<br />
1WIRE BUS RESET OK<br />
1WIRE WRITE ROM COMMAND: MATCH (0&#215;55) *follow with 64bit address<br />
1WIRE ADDRESS MACRO 1: 0x2D 0&#215;54 0xD2 0xEF 0&#215;00 0&#215;00 0&#215;00 0x2B<br />
1WIRE WRITE: 0xF0 <strong>&lt;&#8211;read memory</strong><br />
1WIRE WRITE: 0&#215;00 <strong>&lt;&#8211;start address (2 bytes)</strong><br />
1WIRE WRITE: 0&#215;00<br />
1WIRE BULK READ, 0&#215;08 BYTES: <strong>&lt;&#8211;read back data</strong><br />
0&#215;00 0&#215;01 0&#215;02 0&#215;03 0&#215;04 0&#215;05 0&#215;06 0&#215;07<br />
1WIRE BULK READ, 0&#215;08 BYTES: <strong>&lt;&#8211;read beyond our data</strong><br />
0&#215;00 0&#215;00 0&#215;00 0&#215;00 0&#215;00 0&#215;00 0&#215;00 0&#215;00<br />
1-WIRE&gt;</p></blockquote>
<p>Command 0xf0 followed by a two byte memory address (0&#215;00 0&#215;00) begins the data read process. The first eight bytes (r:8) are the values we wrote earlier. Reads don&#8217;t involve the scratch pad and don&#8217;t have an 8byte limit, so further reads continue to the end of the memory.</p>
<p>Don&#8217;t forget to catch up on any <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed.</p>
<br />Posted in parts, tool hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/6785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/6785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/6785/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=6785&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2008/12/24/parts-1k-1-wire-eeprom-ds2431/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/12/1keeprom-450.jpg" medium="image">
			<media:title type="html">1keeprom-450</media:title>
		</media:content>
	</item>
	</channel>
</rss>
