<?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 problem in nrf51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10844/i2c-problem-in-nrf51822</link><description>hello there i am trying to interface adxl345 with nrf51822. my code is like 
 #define ADXL345_ADDR 0x53U
#define ADXL345_ADDR_WR 0xA6U
#define ADXL345_ADDR_RD 0xA7U
#define ADXL345_REG_MODE 0x2DU

/* Mode for MMA7660. */
#define ACTIVE_MODE 8u</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 14 Dec 2015 12:09:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10844/i2c-problem-in-nrf51822" /><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40566?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2015 12:09:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70bc88da-a1a7-4d07-b893-0b6f3561e21f</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The address is shifted in the driver, so 0xA6 with write will be clocked out as 0x4C and 0xA7 will be clocked out as 0x4E. The read/write bit is handled by the driver, you should only pass in the address: ADXL345_ADDR (0x53). If nrf_drv_twi_tx is called, this will translate to 0xA6 being clocked out, if nrf_drv_twi_rx is called, 0xA7 will be clocked out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40565?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2015 02:16:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63ac657c-a3b1-4160-9643-15efc16f8b69</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;ok so should i read rxdata&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40564?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2015 02:11:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efa11890-71c7-4694-a159-523993e20ece</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;wait for the callback - read the buffer you sent in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40563?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2015 02:08:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc1f3479-b36a-49d5-8992-964d1c75e022</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;ok but how to get read data??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40562?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2015 00:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af186ca5-7dcb-470a-83d4-cdb727f49a9e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;if the rx function isn&amp;#39;t calling you back then either the thing isn&amp;#39;t sending data because it&amp;#39;s not in a mode to send data, or it&amp;#39;s not sending 6 bytes of it and the driver is waiting for the rest of it, or you&amp;#39;re getting an error. You&amp;#39;re likely to have to do a write to tell the device that&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;you want data&lt;/li&gt;
&lt;li&gt;which register you want data from&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;that write probably goes with the final flag set to true so you get a repeated start and not a new start. Then you send the read, perhaps waiting until the write completes first, perhaps not if the two commands can be buffered after each other.&lt;/p&gt;
&lt;p&gt;and that rx_data[] better not be a stack variable if you&amp;#39;re passing it to a function because it&amp;#39;ll get stomped on as soon as you return.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40561?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 17:08:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cfc0a7d-2060-484b-a772-e057e2d6ee4c</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;return value of function nrf_drv_twi_rx is
NRF_SUCCESS or NRF_ERROR_BUSY. then how to read data and store it in array&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40560?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 17:01:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97c745aa-278c-4cf8-bcf8-090399719b5c</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;i know that sequence.
but this sequence&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ret_code_t err_code;

uint8_t rx_data[6];
err_code = nrf_drv_twi_rx(&amp;amp;m_twi_adxl_345,ADXL345_ADDR_RD, rx_data, sizeof(rx_data), false);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;give me nothing data&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40559?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 14:57:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b139e53-61f4-405f-9249-978cb43054ba</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well I assume for reading you first do a write, with the flag set to true, then you do a read which reads back the data. The datasheet on the device should tell you the sequence you need to read from a register, it must be something like write to the register, then read data from the chip.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40558?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 13:05:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bde879f5-2316-487c-b3bf-cadc9bd12caa</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;can you explain me twi event handler&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40557?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 12:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88ae4c3f-7949-4a36-aaea-79dc8e6f5583</guid><dc:creator>rushin</dc:creator><description>&lt;p&gt;thanks i understand nrf_drv_twi_tx function.but i can&amp;#39;t understand nrf_drv_twi_rx function. if i want to read 6 byte data from 0x32 address??&lt;/p&gt;
&lt;p&gt;my code is like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ret_code_t err_code;

uint8_t rx_data[6];
err_code = nrf_drv_twi_rx(&amp;amp;m_twi_adxl_345,ADXL345_ADDR_RD, rx_data, sizeof(rx_data), false);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;how to store this 6 byte data and how to start reading data from perticular address like 0x32?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I2C problem in nrf51822</title><link>https://devzone.nordicsemi.com/thread/40567?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2015 11:59:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61f2d1aa-ea80-4371-ad84-c753ba5abda6</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;can you use the code button (which really just indents every line by 4 spaces) to format that so it&amp;#39;s readable and looks like code please, in that state it&amp;#39;s just impossible to even see what you&amp;#39;re trying.&lt;/p&gt;
&lt;p&gt;I answered something similar a few weeks ago &lt;a href="https://devzone.nordicsemi.com/question/59095/using-nrf51422-as-i2ctwi/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt; was the question&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>