<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>I2C Returning Same Wrong Value</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19480/i2c-returning-same-wrong-value</link><description>Trying to keep this as short as possible. I have 3 I2C devices on a bus. A LSM303(accelerometer + magnetometer), a high precision temp sensor, tricolor LED driver TCA6057,and a L3GD20(gyroscope). The gyro and the accelo are made by the same company and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Feb 2017 13:07:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19480/i2c-returning-same-wrong-value" /><item><title>RE: I2C Returning Same Wrong Value</title><link>https://devzone.nordicsemi.com/thread/75671?ContentTypeID=1</link><pubDate>Mon, 06 Feb 2017 13:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f7c60b9-cbab-4197-be18-01b143cf2729</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;When reading a register you should use repeated start (this is specified in the L3GD20 datasheet, repeated
START (SR) condition). You can do this by setting no_stop to true in the twi tx function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_twi_tx( ... , true);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reading the WHOAMI (0x0F) register like Roger said is also a good idea to check that the twi connection to the chip is good.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C Returning Same Wrong Value</title><link>https://devzone.nordicsemi.com/thread/75670?ContentTypeID=1</link><pubDate>Mon, 06 Feb 2017 02:02:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e588cf3-3fc5-4dcf-9c78-deb61066c46a</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;I suggest you simplify you code and write a test function that simply gets the value of the ID register (or something similar) in those devices (most devices have some sort of ID or WHOAMI register which contains a code that indicates what device it is)&lt;/p&gt;
&lt;p&gt;Also.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know about TWI, but for SPI, if the first byte of the data is the register number, the response is in rx_buf[1] not rx_buf[0]&lt;/p&gt;
&lt;p&gt;Did you try looking in m_fromI2Cdevice[1]; (if your buff is longer than 1 byte)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>