<?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: Maple i2c with Arduino</title>
		<link>http://forums.leaflabs.com/topic.php?id=10041</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:26:54 +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=10041" rel="self" type="application/rss+xml" />

		<item>
			<title>_Jesmeister_ on "Maple i2c with Arduino"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10041#post-21908</link>
			<pubDate>Mon, 07 Jan 2013 21:00:30 +0000</pubDate>
			<dc:creator>_Jesmeister_</dc:creator>
			<guid isPermaLink="false">21908@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;gbulmer: &#60;/p&#62;
&#60;p&#62;I may not have been clear on the &#34;transferring only once&#34;. The Arduino will correctly receive one transfer from the Maple, but subsequent transfer attempts fail. This should answer your second question too. &#60;/p&#62;
&#60;p&#62;The code above underneath &#34;Arduino Slave&#34; is the Arduino code. &#60;/p&#62;
&#60;p&#62;I'm not sure that I understand your third comment, but looking at the wire library (&#60;a href=&#34;http://leaflabs.com/docs/libs/wire.html#libs-wire&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/libs/wire.html#libs-wire&#60;/a&#62;) I use the endTransmission() function to find the return value. That return value is 0 when I first upload the sketch to the maple. It will make one successful transfer to the Arduino upon which the return value of endTransmission(); becomes a 2. As I am reading and according to the i2c.h file a 2 indicates: &#60;/p&#62;
&#60;p&#62;ENACKADDR: Did not receive ACK on transmit of address. No bytes are actually sent when this happens.&#60;/p&#62;
&#60;p&#62;To account for the differing voltage levels, I believe that 3.3V should still be high enough to trigger a HIGH input voltage on the Arduino (I am getting one valid transfer). I did, however, wire up some 5V pull ups on the I2C lines just to be sure and that was not the problem. It still exhibited the same behavior. &#60;/p&#62;
&#60;p&#62;I have also wired up the maple to an oscilloscope and it is definitely attempting a transfer whenever I ask it to.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Maple i2c with Arduino"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10041#post-21905</link>
			<pubDate>Mon, 07 Jan 2013 17:37:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21905@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;_Jesmeister_ - I think your assumption &#34;when I use the maple I can only successfully transfer once.&#34; may be incorrect.&#60;/p&#62;
&#60;p&#62;From your list of symptoms, the Arduino never responds in any way. Is that correct?&#60;br /&#62;
You do not mention any code running on the Arduino which indicates it has received anything, so I assume not.&#60;/p&#62;
&#60;p&#62;If you assume that the Arduino never detected or received a message, and hence never attempts to respond, the symptoms still look consistent.&#60;/p&#62;
&#60;p&#62;Maple signals are 0v to 3.3V and Arduino 0v to 5V. How are you accounting for the different voltage levels between the two devices?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>_Jesmeister_ on "Maple i2c with Arduino"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10041#post-21899</link>
			<pubDate>Mon, 07 Jan 2013 13:04:18 +0000</pubDate>
			<dc:creator>_Jesmeister_</dc:creator>
			<guid isPermaLink="false">21899@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm at a loss here. Any help would be greatly appreciated. I'm attempting to use a Maple leaf board (rev5) as an I2C master that interfaces with an Arduino (any board) acting as an I2C slave. I've swapped out a second Arduino for the Maple and the code seems to work. However, when I use the maple I can only successfully transfer once. By transfer once, I mean that the communication seems to stop after the first successful Wire.endTransmission(). Through troubleshooting here is what I've found so far. &#60;/p&#62;
&#60;p&#62;1. When not connected to any device the return value of  Wire.endTransmission(); is 0, which according to the maple documentation says the transfer was successful. &#60;/p&#62;
&#60;p&#62;2. The maple must be rebooted to make another transfer. &#60;/p&#62;
&#60;p&#62;3. rebooting the Arduino does not seem to make a difference. &#60;/p&#62;
&#60;p&#62;4. After the first successful transfer from the maple the return value of Wire.endTransmission(); is = 2. That means that the slave is not sending an ACK upon its address being sent. &#60;/p&#62;
&#60;p&#62;5. 5V pull ups on the Arduino did not do anything. &#60;/p&#62;
&#60;p&#62;The only thing I can think is that there is some difference in the lower level protocol between the maple and the Arduino. Any ideas? &#60;/p&#62;
&#60;p&#62;Here's the relevant codes: &#60;/p&#62;
&#60;p&#62;Maple Master: &#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
    if(z_pos != z_pos_old){&#60;br /&#62;
       SerialUSB.print(z_pos);&#60;br /&#62;
       Wire.beginTransmission(5);&#60;br /&#62;
          byte1 = z_pos &#38;amp; 255;&#60;br /&#62;
          byte2 = z_pos &#38;gt;&#38;gt; 8;&#60;br /&#62;
            Wire.send(byte1);            // sends one byte&#60;br /&#62;
            Wire.send(byte2);            // sends one byte&#60;br /&#62;
            rtnval = Wire.endTransmission();    // stop transmitting&#60;br /&#62;
            SerialUSB.print(&#34; return value = &#34;);&#60;br /&#62;
            SerialUSB.println(rtnval);&#60;/p&#62;
&#60;p&#62;    }&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Arduino slave&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
#include &#38;lt;Wire.h&#38;gt;&#60;br /&#62;
int byte1, byte2;&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;br /&#62;
  Wire.begin(5);                // join i2c bus with address #4&#60;br /&#62;
  Wire.onReceive(receiveEvent); // register event&#60;br /&#62;
  Serial.begin(9600);           // start serial for output&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop()&#60;br /&#62;
{&#60;br /&#62;
  delay(1000);&#60;br /&#62;
  Serial.println(&#34;waiting&#34;);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;// function that executes whenever data is received from master&#60;br /&#62;
// this function is registered as an event, see setup()&#60;br /&#62;
void receiveEvent(int howMany)&#60;br /&#62;
{&#60;br /&#62;
  int x = Wire.available();&#60;br /&#62;
  Serial.print(&#34;available: &#34;);&#60;br /&#62;
  Serial.print(x);&#60;br /&#62;
  byte1 = Wire.read();    // receive byte as an integer&#60;br /&#62;
  byte2 = Wire.read();&#60;br /&#62;
  byte2 = byte2 &#38;lt;&#38;lt; 8;&#60;br /&#62;
  byte2 = byte2 + byte1;&#60;br /&#62;
  Serial.print (&#34; position: &#34;);&#60;br /&#62;
  Serial.println(byte2);&#60;br /&#62;
  x = Wire.available();&#60;br /&#62;
  Serial.print(&#34;available: &#34;);&#60;br /&#62;
  Serial.print(x);&#60;br /&#62;
  Wire.begin(5);&#60;/p&#62;
&#60;p&#62;}&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
