<?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: I2C Maple with AM2315 (Temperature and Humidity sensor)</title>
		<link>http://forums.leaflabs.com/topic.php?id=11983</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:04:57 +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=11983" rel="self" type="application/rss+xml" />

		<item>
			<title>Phono on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983&amp;page=2#post-105248</link>
			<pubDate>Thu, 20 Feb 2014 08:23:26 +0000</pubDate>
			<dc:creator>Phono</dc:creator>
			<guid isPermaLink="false">105248@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
for those who still need help with interfacing the AM2315, I eventually succeeded.&#60;br /&#62;
Here is the recipie.&#60;/p&#62;
&#60;p&#62;1) perform the changes by elstonj :
&#60;li&#62;&#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=1145&#34; rel=&#34;nofollow&#34;&#62;http://forums.leaflabs.com/topic.php?id=1145&#60;/a&#62;&#60;/li&#62;
&#60;p&#62;Next&#60;/p&#62;
&#60;p&#62;2) include a special function to wake up the sensor :&#60;br /&#62;
  Wire.beginTransmission( ADRESSE_AM2315 ) ;&#60;br /&#62;
  i2c_start(port);&#60;br /&#62;
  i2c_shift_out(port, (ADRESSE_AM2315 &#38;lt;&#38;lt; 1) &#124; I2C_WRITE);&#60;br /&#62;
  i2c_send_ack(port) ;&#60;br /&#62;
  vTaskDelay( DELAY(2) ) ; // Or equivalent, to hold the lines from 800 µs to 3 ms&#60;br /&#62;
  i2c_stop(port);&#60;/p&#62;
&#60;p&#62;3) Include the delays requested by the manufacturer&#60;br /&#62;
  vTaskDelay(DELAY(1));&#60;br /&#62;
  Wire.beginTransmission( ADRESSE_AM2315 ) ;&#60;br /&#62;
  Wire.send( AM2315_READREG ) ;&#60;br /&#62;
  Wire.send( AM2315_ADRREG ) ;&#60;br /&#62;
  Wire.send( AM2315_NB_BYTES ) ;&#60;/p&#62;
&#60;p&#62;  if ( Wire.endTransmission() == SUCCESS )&#60;br /&#62;
  {&#60;br /&#62;
    vTaskDelay(DELAY(3));&#60;br /&#62;
    n = Wire.requestFrom( ADRESSE_AM2315, AM2315_NB_BYTES ) ;&#60;br /&#62;
    vTaskDelay(DELAY(1));&#60;br /&#62;
    if ( n == AM2315_NB_BYTES )&#60;br /&#62;
    {&#60;br /&#62;
      n = Wire.receive() ;    // Last Command&#60;br /&#62;
      n = Wire.receive() ;    // Byte number&#60;br /&#62;
      Hamb = ( Wire.receive() &#38;lt;&#38;lt; 8 ) ;    // 1st data byte&#60;br /&#62;
      Hamb += Wire.receive() ;            // 2nd data byte&#60;br /&#62;
      Tamb = ( Wire.receive() &#38;lt;&#38;lt; 8 ) ;    // 3rd data byte&#60;br /&#62;
      Tamb += Wire.receive() ;            // 4th data byte&#60;br /&#62;
    }&#60;br /&#62;
  }&#60;/p&#62;
&#60;p&#62;4) Please note that :&#60;br /&#62;
- The nb of bytes must be 6 : Command, Nb bytes, and the four bytes of the data&#60;br /&#62;
- The sensor I2C address is actually 0x5C and not 0xB8 as you can read in the documentation.&#60;/p&#62;
&#60;p&#62;Hope this will help ! &#60;/p&#62;
&#60;p&#62;I wish someone could update the libraries in the repository. This holds true also for the bxCAN library for Olimex boards.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983&amp;page=2#post-27226</link>
			<pubDate>Mon, 24 Jun 2013 03:22:20 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27226@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok thanks gbulmer, tests are OK, i don't have fried the board. I still cannot reach the oscilloscope (maybe tomorrow I hope..)&#60;/p&#62;
&#60;p&#62;You asked me what version of Wire (soft) library I use.&#60;br /&#62;
I have tried 2 versions:&#60;/p&#62;
&#60;p&#62;a) wire library included in the IDE&#60;br /&#62;
b) wire library provided by ala42: &#60;a href=&#34;http://home.arcor.de/ala42/Wire.zip&#34; rel=&#34;nofollow&#34;&#62;http://home.arcor.de/ala42/Wire.zip&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;both with no luck.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983&amp;page=2#post-27180</link>
			<pubDate>Sun, 23 Jun 2013 06:49:49 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">27180@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosardegna - &#60;em&#62;&#34;I will try to use another board, maybe I've fried the Maple using non 5V-tolerant ports..&#34;&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;If you haven't got another board handy, you could test the pins using the board itself.&#60;br /&#62;
Start with something like the Maple IDE example programs Blink, and a LED, button and a couple of 1K resistor (which should be enough to turn the LED on, and big enough to be easy to pull up or down).&#60;br /&#62;
Test the non-5V tolerant pin 4 to see that it is okay. Check 5V tolerant pins with a 5V supply and use the button or a second pin to create a test signal.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983&amp;page=2#post-27168</link>
			<pubDate>Sat, 22 Jun 2013 17:08:14 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27168@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Moreaover, I will never change the pinMode I let that I2C protocol change the state of the pin in OUTPUT_OPEN_DRAIN without my command on the sketch.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-27167</link>
			<pubDate>Sat, 22 Jun 2013 17:05:17 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27167@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I mean Hardware I2C not SPI sorry ;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-27166</link>
			<pubDate>Sat, 22 Jun 2013 17:04:31 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27166@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi gbulmer and many thanks for the reply :-)&#60;/p&#62;
&#60;p&#62;Summary:&#60;br /&#62;
- unfortunately I don't have an oscilloscope (if i can i will steal from work only to grab the values.. maybe on Tuesday I hope...)&#60;/p&#62;
&#60;p&#62;- I have changed pin and i'm using 5V tolerant pins (6-7) with no luck&#60;br /&#62;
- I changed pullup with 4k7 for boh SDA and SCL with no luck&#60;br /&#62;
- I've tryed to use Hardware SPI on port 2 (pin 29 and 30) with no luck&#60;br /&#62;
- I suppouse the problem could be that the sensor works at 5V so I've ordered a level shifter 3v3 to 5v.. I'm waiting for next week&#60;br /&#62;
- I will try to read the value with a multimeter when I call begin() function as you have suggested&#60;br /&#62;
- I will try to use Maple as slave as you have suggested&#60;/p&#62;
&#60;p&#62;&#60;code&#62;I will try to use another board, maybe I&#38;#39;ve fried the Maple using non 5V-tolerant ports..&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;see you soon!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-27161</link>
			<pubDate>Sat, 22 Jun 2013 14:57:54 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">27161@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosardegna - I am not a user of I2C on Maple, but I have used I2C devices, and the Arduino library.&#60;br /&#62;
I have got a bit lost as to the exact configuration of everything, so I may have misunderstood or be going over 'old ground' which is no longer relevant ...&#60;/p&#62;
&#60;p&#62;Have you got access to an oscilloscope, or a voltmeter/multimeter?&#60;br /&#62;
Can you see that the 3.3V pins of the Maple are being pulled up to 5V when I2C is 'off'?&#60;/p&#62;
&#60;p&#62;I'd like to understand the answers to these questions:&#60;br /&#62;
1. Is it using pins 4 and 5?&#60;br /&#62;
2. Is it doing pinMode(..., INPUT_PULLUP)?&#60;br /&#62;
3. Is it using the 'soft' Wire library? Which one?&#60;/p&#62;
&#60;p&#62;Pin 4 is &#60;strong&#62;not 5V tolerant&#60;/strong&#62;, so it will not work. Pin 5 is okay. Choose a different pin instead of pin 4.&#60;/p&#62;
&#60;p&#62;Based on &#60;a href=&#34;http://leaflabs.com/docs/hardware/maple.html#gpio-port-pin-map&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/hardware/maple.html#gpio-port-pin-map&#60;/a&#62; the 'obvious' pins to use are:&#60;br /&#62;
- D5 for SCL, and D9 for SDA. These are 5V tolerant, and are connected to the built in I2C hardware peripheral; so it might eventually use the I2C hardware.&#60;br /&#62;
- D29 for SCL and D30 for SDA. These are 5V tolerant, and are connected to the second built in I2C hardware peripheral; so it might eventually use the I2C hardware.&#60;br /&#62;
- Other 5V tolerant pins should work with the 'soft' Wire library.&#60;/p&#62;
&#60;p&#62;My reading of the STM32F103xB datasheet is a 5V tolerant INPUT pin &#60;strong&#62;must never&#60;/strong&#62; be set to INPUT_PULLUP. AFAIK, the built-in pull-up resistor will pull the pin to Maple's 3.3V Vdd power-supply voltage. According to the datasheet, in section &#34;5.3.13 I/O port characteristics&#34; note 1 says &#34;In order to sustain a voltage higher than Vdd+0.3 the internal pull-up/pull-down resistors must be disabled. &#34; &#60;/p&#62;
&#60;p&#62;I don't want to be too paranoid, but it is possible that part of the pin driver could be damaged by setting the pin with INPUT_PULLUP and connecting it to a 5V line with a small enough resistor. The datasheets seems to say (no guarantees from me) the pin should be okay providing the current is limited to less than 5mA.&#60;/p&#62;
&#60;p&#62;So, if you want a 5V tolerant input pin to be pulled up to 5V, then it &#60;strong&#62;must&#60;/strong&#62; be pulled up by an &#60;strong&#62;external&#60;/strong&#62; resistor connecting the 5V tolerant pin to 5V. &#60;/p&#62;
&#60;p&#62;As ala42 has said, the pull-up resistor should be about 4.7K.&#60;br /&#62;
A circuit is given in the STM32F103xB datasheet in &#34;Figure 31. I2C bus AC waveforms and measurement circuit.&#34; As well as the 4.7K pull-up resistors, it also has a 100 ohm resistor in series in each line, between the Maple pins and the device. I think they're optional.&#60;/p&#62;
&#60;p&#62;AFAIK, if you're using a soft I2C (Wire) library, when the Maple is acting as an I2C master, the clock pin (SCL) should be set to a pinMode of OUTPUT_OPEN_DRAIN. the data line (SDA) should be OUTPUT_OPEN_DRAIN too.&#60;br /&#62;
My reading of RM0008 the STM32F103 peripheral programming manual, is the SDA pin is correctly configured to be 5V tolerant for input (for reading) too by setting &#60;code&#62;pinMode(...,  OUTPUT_OPEN_DRAIN)&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;I have had a look at the code in the old Maple's Wire library, and ala42's, which are 'soft' implementation, and AFAICT, they are the same w.r.t. setting both the clock (SCL) and the data line (SDA), to be pinMode OUTPUT_OPEN_DRAIN in &#60;code&#62;TwoWire::begin(uint8, uint8)&#60;/code&#62;, so they should work, and should not need the main program to call &#60;code&#62;pinMode&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Summary: use 5V tolerant pins, with 4,7K pull-ups resistors, and don't set the pinMode, but let the Wire library do it.&#60;/p&#62;
&#60;p&#62;AFAICT the AM2315 is a 3.5V to 5V device, so it may be that it doesn't like running at 3.3V? It seems a bit tight, but that might be the case; it might be pernickety. If the SCL and SDA lines aren't correctly set up&#60;/p&#62;
&#60;p&#62;While the datasheet (&#60;a href=&#34;http://www.adafruit.com/datasheets/AM2315.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.adafruit.com/datasheets/AM2315.pdf&#60;/a&#62;) says:&#60;br /&#62;
&#60;em&#62;INPUT HIGH   70% Vdd&#60;/em&#62; which would be 5V * 0.7 = 3.5V&#60;/p&#62;
&#60;p&#62;If the AM2315 is running at 5V, then it might also be that, if the lines aren't correctly set (i.e. one is pin 4, or they are set with pinMode OUTPUT_OPEN_DRAIN), that either SCL or SDA, or both aren't being puled to 5V. &#60;/p&#62;
&#60;p&#62;If you have an oscilloscope, you should be able to see the pins sitting at 5V or 3.3V.&#60;br /&#62;
If you have not got access to an oscilloscope, then you should be able to see the voltage on the pins with a DC voltmeter/multimeter when I2C has been &#60;code&#62;TwoWire::begin(...,...)&#60;/code&#62; and no transmission has happened.&#60;/p&#62;
&#60;p&#62;Alternately, you might try running the Arduino as an I2C 'slave' device, and seeing what it picks up from the Maple.&#60;br /&#62;
Another possibility is to try to run the Maple as an I2C slave, in parallel with the AM2315, with the Arduino driving the singnals. Then have a look to see if the Maple interferes with or breaks the conversation between the Arduino and sensor, which might also indicate that the Maple pins are not correctly configured.&#60;/p&#62;
&#60;p&#62;If voltage is a problem, there is a way to interface an 3.3V I2C with 5V I2C at &#60;a href=&#34;http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf&#34; rel=&#34;nofollow&#34;&#62;http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;However, I think that it shouldn't be needed if Maple 5V tolerant pins are used for I2C, and are configured correctly to pinMode OUTPUT_OPEN_DRAIN. (but I have been wrong before :-).&#60;/p&#62;
&#60;p&#62;(Full disclosure: I am not a member of LeafLabs staff.)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-27160</link>
			<pubDate>Sat, 22 Jun 2013 13:46:06 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27160@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ummm.. guys I tried I2C Hardware implementation developed by crenn:&#60;br /&#62;
&#60;a href=&#34;http://www.crennsmind.com/Code/Maple/Libraries/WireBase/Wire-120630.zip&#34; rel=&#34;nofollow&#34;&#62;http://www.crennsmind.com/Code/Maple/Libraries/WireBase/Wire-120630.zip&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;It seems that with this library i'm near to the solution, but there is sothing really strange. I explain:&#60;/p&#62;
&#60;p&#62;If I put the 2 pullups of 4k7 on SDA/SCL lines I receive a message from sensor like this:&#60;br /&#62;
byte[0] = 3&#60;br /&#62;
byte[1] = FF&#60;br /&#62;
byte[2] = FF&#60;br /&#62;
byte[3] = FF&#60;br /&#62;
byte[4] = FF&#60;br /&#62;
byte[5] = FF&#60;br /&#62;
byte[6] = FF&#60;br /&#62;
byte[7] = FF&#60;/p&#62;
&#60;p&#62;first byte is CORRECT. the others remain always high. BUT... if I change the pullups in as following:&#60;/p&#62;
&#60;p&#62;SDA line -&#38;gt; without pullup&#60;br /&#62;
SCL line -&#38;gt; PULLDOW of 4k7&#60;/p&#62;
&#60;p&#62;random I receive data CORRECT!!&#60;br /&#62;
byte[0] = 3&#60;br /&#62;
byte[1] = 4&#60;br /&#62;
byte[2] = 1&#60;br /&#62;
byte[3] = AA&#60;br /&#62;
byte[4] = 1&#60;br /&#62;
byte[5] = 9&#60;br /&#62;
byte[6] = 11&#60;br /&#62;
byte[7] = A2&#60;/p&#62;
&#60;p&#62;after I receive &#34;00 00 00 00 00 00 00&#34;, after again &#34;FF FF FF FF FF FF FF FF&#34;, after again correct data &#34;3 4 1 AA 1 9 11 A2&#34;, after again &#34;00 00 00 00 00 00 00&#34;....&#60;/p&#62;
&#60;p&#62;but all what I receive is random.. I can receive good data for 3 times, after I get always zero for 5 minutes, after good data, after always FF...&#60;/p&#62;
&#60;p&#62;after 10-15 minutes I receive always zero..&#60;/p&#62;
&#60;p&#62;If I change pullups I never receive good data.. Is it a problem of speed? &#60;/p&#62;
&#60;p&#62;I'm using Hardware I2C (port 2, pin 29 for SCL and pin 30 for SDA).&#60;/p&#62;
&#60;p&#62;this is the code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;lt;HardWire.h&#38;gt;
#include &#38;lt;Wire.h&#38;gt;
#include &#38;lt;WireBase.h&#38;gt;

#include &#38;lt;stdint.h&#38;gt;

#define AM2315_I2CADDR       0x5C
#define AM2315_READREG       0x03

HardWire port(2);

void setup() {
  delay(5000);
}

void loop() {
uint8_t reply[10];

port.beginTransmission(AM2315_I2CADDR);
port.send(AM2315_READREG);
port.send(0x00);  // start at address 0x0
port.send(4);  // request 4 bytes data
port.endTransmission();

delay(1);

port.beginTransmission(AM2315_I2CADDR);
port.send(AM2315_READREG);
port.send(0x00);  // start at address 0x0
port.send(4);  // request 4 bytes data
port.endTransmission();

port.requestFrom(AM2315_I2CADDR, 8);
  for (uint8_t i=0; i&#38;lt;8; i++) {
    reply[i] = port.receive();
    SerialUSB.println(reply[i], HEX);
  }

  SerialUSB.println(&#38;quot;&#38;quot;);

  delay(3000);

}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-27159</link>
			<pubDate>Sat, 22 Jun 2013 11:55:46 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">27159@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Bad news again..&#60;br /&#62;
pull-up of 4k7 on SDA and SCL.&#60;/p&#62;
&#60;p&#62;Arduino works always fine, no luck with Maple.&#60;/p&#62;
&#60;p&#62;I'm trying different speed modifying:&#60;/p&#62;
&#60;p&#62;#define I2C_DELAY_SCL delay_us(5)&#60;br /&#62;
#define I2C_DELAY_SDA delay_us(5)&#60;/p&#62;
&#60;p&#62;in &#60;/p&#62;
&#60;p&#62;#define I2C_DELAY_SCL delay_us(7)&#60;br /&#62;
#define I2C_DELAY_SDA delay_us(7)&#60;/p&#62;
&#60;p&#62;or 8,9...&#60;br /&#62;
do you have a simple example sketch that works with this Wire library?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26915</link>
			<pubDate>Mon, 17 Jun 2013 18:44:42 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">26915@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;1k is a bit too small, 3k3 or 4k7 are fine.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26884</link>
			<pubDate>Mon, 17 Jun 2013 06:36:28 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">26884@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Tests are in progress.. for now no luck with the library..&#60;br /&#62;
if I've understood this is the code for maple on Wire.h to change:&#60;/p&#62;
&#60;p&#62;'&#60;br /&#62;
#if (F_CPU == 168000000)&#60;br /&#62;
	#define I2C_DELAY_SCL delay_ns100(6)&#60;br /&#62;
	#define I2C_DELAY_SDA delay_ns100(2)&#60;br /&#62;
#else&#60;br /&#62;
	#define I2C_DELAY_SCL delay_us(5)&#60;br /&#62;
	#define I2C_DELAY_SDA delay_us(5)&#60;br /&#62;
#endif&#60;br /&#62;
'&#60;br /&#62;
I use only one sensor for I2C.&#60;/p&#62;
&#60;p&#62;I've replaced a pullup of 1Kohm with no luck. Next updates are foreseen for tonight.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26668</link>
			<pubDate>Mon, 10 Jun 2013 21:08:24 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">26668@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Try your luck with by wire lib &#60;a href=&#34;http://home.arcor.de/ala42/Wire.zip&#34; rel=&#34;nofollow&#34;&#62;http://home.arcor.de/ala42/Wire.zip&#60;/a&#62;&#60;br /&#62;
To lower the speed to 100kHz, change lines 60+61 to&#60;br /&#62;
	#define I2C_DELAY_SCL delay_us(5)&#60;br /&#62;
	#define I2C_DELAY_SDA delay_us(5)&#60;br /&#62;
Defining the pins as OUTPUT_OPEN_DRAIN was already correct. A 10K pull up is a bit high, might work for 100kHz, should cause trouble for 400kHz, especially when you use cables and several devices on the bus.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>franco on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26660</link>
			<pubDate>Mon, 10 Jun 2013 12:05:46 +0000</pubDate>
			<dc:creator>franco</dc:creator>
			<guid isPermaLink="false">26660@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I suggest to use other pins, like 35,36 for SDA and SCL because they are 5V tolerant (as specified by the sensor).&#60;/p&#62;
&#60;p&#62;Simply connect the red wire to 5V power, black to ground, yellow wire to your i2c data pin, and the white wire to the i2c clock pin. You cannot change the i2c address so only one sensor per i2c bus. Two ~10Kohm pullup resistors are required for use, connect from the SDA and SCL lines to the power wire, the pullup resistors are not included!&#60;/p&#62;
&#60;p&#62;However I have the same problem. I use an external power supply (5V) and 10kohm for pullup. for now no luck.&#60;/p&#62;
&#60;p&#62;I don't have an oscilloscope but it seems there is an error on data in/out.&#60;/p&#62;
&#60;p&#62;(Edit: franco, I edited the markup so that the text fits within the width of a page to make it easier to read, I hope that was okay. gbulmer)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26635</link>
			<pubDate>Sun, 09 Jun 2013 05:49:34 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">26635@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I have changed i&#38;lt;500 for the &#34;nop&#34; and I vahe declared &#34;INPUT_PULLUP&#34; for the pins SDA and SCL inside Wire.h and Wire.cpp but nothing.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosardegna on "I2C Maple with AM2315 (Temperature and Humidity sensor)"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11983#post-26634</link>
			<pubDate>Sun, 09 Jun 2013 05:32:37 +0000</pubDate>
			<dc:creator>ventosardegna</dc:creator>
			<guid isPermaLink="false">26634@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks for the suggestion but i get always zero.&#60;/p&#62;
&#60;p&#62;[code]&#60;br /&#62;
void setup() {&#60;br /&#62;
  delay(7000);&#60;br /&#62;
  pinMode(4, INPUT_PULLUP);&#60;br /&#62;
  pinMode(5, INPUT_PULLUP);&#60;/p&#62;
&#60;p&#62;//  Serial.begin(9600);&#60;br /&#62;
Wire.begin(4,5); //SDA, SCL&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;[/code]&#60;/p&#62;
&#60;p&#62;I have made another try using an external power of 3V3 and using only pins 4 and 5 in the Maple and A4 and A5 for Arduino. Arduino reads correct data.&#60;/p&#62;
&#60;p&#62;Moreover this sensor works at maximum 100Khz, do you know which is the speed of the Maple for I2C? Can I eventually drop the speed?&#60;br /&#62;
in Wire.h I read:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;#define I2C_DELAY do{for(int i=0;i&#38;lt;50;i++) {asm volatile(&#38;quot;nop&#38;quot;);}}while(0)&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;maybe I can modify the loop with i&#38;lt;500 ?&#60;/p&#62;
&#60;p&#62;the function that give me an ENACKADDR in Wire.h is the &#34;endTransmission()&#34;:&#60;/p&#62;
&#60;p&#62;[code]&#60;br /&#62;
i2c_start(port);&#60;/p&#62;
&#60;p&#62;i2c_shift_out(port, (tx_addr &#38;lt;&#38;lt; 1) &#124; I2C_WRITE);&#60;br /&#62;
if (!i2c_get_ack(port)) return ENACKADDR;&#60;br /&#62;
[/code]&#60;/p&#62;
&#60;p&#62;However all these tests make me think that the problem is the pullup. I've tried with 10Kohm, 5K and 2,5K. &#60;/p&#62;
&#60;p&#62;in Wire.h these pins are declared as OUTPUT_OPEN_DRAIN so my declaration in setup() is useless:&#60;/p&#62;
&#60;p&#62;[code]&#60;br /&#62;
pinMode(scl, OUTPUT_OPEN_DRAIN);&#60;br /&#62;
pinMode(sda, OUTPUT_OPEN_DRAIN);&#60;br /&#62;
[/code]
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
