<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: ADXL345 and I2C</title>
		<link>http://forums.leaflabs.com/topic.php?id=755</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:09:52 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=755" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4517</link>
			<pubDate>Fri, 06 May 2011 17:58:06 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4517@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Tokenekie,&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
I don't quite understand the hardware I2C from the refactor libmaple repository. If someone can point me to some documentation on how Perry's i2c code works, that would speed up my learning process tremendously.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Docs are in the source code only for now; sorry.  The example usage posted earlier by ridgebackred is very readable, however. There are some more example uses in the Discovery branch page on our wiki:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://wiki.leaflabs.com/index.php?title=ST_Discovery_evaluation_board_community_contributed_libmaple_branch_and_examples&#34; rel=&#34;nofollow&#34;&#62;http://wiki.leaflabs.com/index.php?title=ST_Discovery_evaluation_board_community_contributed_libmaple_branch_and_examples&#60;/a&#62;.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Tokenekie on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4503</link>
			<pubDate>Thu, 05 May 2011 17:49:29 +0000</pubDate>
			<dc:creator>Tokenekie</dc:creator>
			<guid isPermaLink="false">4503@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Crenn,&#60;/p&#62;
&#60;p&#62;I2C soft isn't working out for me. Like I said, I modified the Wire.h and Wire.c code to do multiple byte reads. The following is some of my modified code for soft i2c.&#60;/p&#62;
&#60;p&#62;uint8 TwoWire::requestFrom(uint8 address, int num_bytes) {&#60;br /&#62;
    if (num_bytes &#38;gt; WIRE_BUFSIZ) num_bytes = WIRE_BUFSIZ;&#60;/p&#62;
&#60;p&#62;    rx_buf_idx = 0;&#60;br /&#62;
    rx_buf_len = 0;&#60;/p&#62;
&#60;p&#62;    i2c_start(port);&#60;br /&#62;
    i2c_shift_out(port, (address &#38;lt;&#38;lt; 1) &#124; I2C_READ);&#60;br /&#62;
    if (!i2c_get_ack(port)) return ENACKADDR;&#60;/p&#62;
&#60;p&#62;    while (rx_buf_len &#38;lt; num_bytes) {&#60;br /&#62;
        if(rx_buf_len == num_bytes - 1) {&#60;br /&#62;
            if(!readOneByte(rx_buf + rx_buf_len, HALT)) rx_buf_len++;&#60;br /&#62;
            else break;&#60;br /&#62;
        } else {&#60;br /&#62;
            if(!readOneByte(rx_buf + rx_buf_len, CONTINUE)) rx_buf_len++;&#60;br /&#62;
            else break;&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    i2c_stop(port);&#60;/p&#62;
&#60;p&#62;    return rx_buf_len;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;uint8 TwoWire::readOneByte(uint8 *byte, uint8 status) {&#60;br /&#62;
    *byte = i2c_shift_in(port);&#60;/p&#62;
&#60;p&#62;//    digitalWrite(port.sda,LOW);&#60;/p&#62;
&#60;p&#62;    if (status == CONTINUE) i2c_send_ack(port);&#60;br /&#62;
    else i2c_send_nack(port);&#60;/p&#62;
&#60;p&#62;    return SUCCESS;      // no real way of knowing, but be optimistic!&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;The readings from my oscilloscope shows exactly what the ADXL345 expects for multiple byte i2c reads. (see Figure 40 from &#60;a href=&#34;http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf)&#34; rel=&#34;nofollow&#34;&#62;http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf)&#60;/a&#62;. However, after reading the first byte and sending an ACK, the remaining 5 bytes read are all zeros.&#60;/p&#62;
&#60;p&#62;I don't quite understand the hardware I2C from the refactor libmaple repository. If someone can point me to some documentation on how Perry's i2c code works, that would speed up my learning process tremendously.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mash007 on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4471</link>
			<pubDate>Mon, 02 May 2011 12:36:21 +0000</pubDate>
			<dc:creator>mash007</dc:creator>
			<guid isPermaLink="false">4471@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey Crenn,&#60;/p&#62;
&#60;p&#62;I was also looking for a hardware i2c solution and it looks like you've got it made. Looking forward to your release of the wire library.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4451</link>
			<pubDate>Fri, 29 Apr 2011 19:50:38 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">4451@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;See &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=28&#38;amp;page=6&#34; rel=&#34;nofollow&#34;&#62;http://forums.leaflabs.com/topic.php?id=28&#38;amp;page=6&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I have actually talked with an ADXL345 without issue over I2C using both I2CSoft and I2C1, I've also talked to other devices using I2C2. I haven't finished the development of the new Wire library, but I expect I'll finish it by Monday. I'm currently working on adding 400kHz (FAST_MODE) support and documenting the changes from the Arduino Wire library.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ridgebackred on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4448</link>
			<pubDate>Fri, 29 Apr 2011 13:35:29 +0000</pubDate>
			<dc:creator>ridgebackred</dc:creator>
			<guid isPermaLink="false">4448@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Tokenekie - I am able to read multiple bytes of data from the Wii Motion Plus using the hardware i2c routines from the github refactor 0.0.9 branch.&#60;br /&#62;
I am using the command line compile with libmaple, not in the IDE.&#60;br /&#62;
The README file in the libmaple directory has instructions for a command line environment.&#60;br /&#62;
I used &#60;a href=&#34;http://wiki.leaflabs.com/index.php?title=Edit_sketches_with_Eclipse&#34; rel=&#34;nofollow&#34;&#62;http://wiki.leaflabs.com/index.php?title=Edit_sketches_with_Eclipse&#60;/a&#62; to set up the Eclipse GUI on a Windows machine.&#60;br /&#62;
&#60;a href=&#34;http://snipt.net/ridgebackred/discovery-wii-motion-plus&#34; rel=&#34;nofollow&#34;&#62;http://snipt.net/ridgebackred/discovery-wii-motion-plus&#60;/a&#62; for a code example with the new i2c routines reading multiple bytes.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Tokenekie on "ADXL345 and I2C"</title>
			<link>http://forums.leaflabs.com/topic.php?id=755#post-4447</link>
			<pubDate>Fri, 29 Apr 2011 11:59:07 +0000</pubDate>
			<dc:creator>Tokenekie</dc:creator>
			<guid isPermaLink="false">4447@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I know that the current Maple 0.0.9 doesn't support I2C completely, but I wonder if anyone has ever played around with the ADXL345 and the Maple board via I2C instead of SPI.&#60;/p&#62;
&#60;p&#62;I modified my local copy of the Wire library to support stuff like multiple-byte reads, but I cant seem to get my ADXL345 to give me more than one byte of data despite verifying that I've executed the correct protocol using an oscilloscope.&#60;/p&#62;
&#60;p&#62;(By the way, I wish the forum had more features such as posting pictures so I can show everyone what I mean)
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
