<?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>TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7293/twi-i2c-device-unable-to-read-write-the-device-irrespective-of-following-reference-manual</link><description>Here are my functions which i wrote for reading / writing the i2c slave device ( after reading reference manual (nrf51422) . Unfortunately they are not working. Plz help me with the code. 
 void twi_init_slz(void )
{
	(*(unsigned volatile int *)0x040003500</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Jun 2015 07:28:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7293/twi-i2c-device-unable-to-read-write-the-device-irrespective-of-following-reference-manual" /><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25783?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2015 07:28:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dd725fb-20c5-442b-b6ed-99662c90ed80</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;It is the check mark under the voting buttons to the left of the answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25782?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 14:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8481ef5-53f5-48bc-916b-cf79bf5fc725</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;Where is the answer accepted button, which i need to click after getting satified answer?  i looked for a while but didn&amp;#39;t find any .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25781?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2015 13:37:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cd4381f-11e6-4da2-a716-eab7cda4774e</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;Thanks a lot for the answer.
Do i need to setup the pull up resistor for  the PSELSCL and PSELSDA ??  or its enough to configure those pins as input and SODI (as per the data sheet)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25780?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2015 09:47:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c547634-3fdf-4cad-9bae-73db9bd61ae8</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;The shifting is just a part of the TWI specification. TWI uses 7 bit addressing + a read/write bit: &lt;a href="http://www.totalphase.com/support/articles/200349176-7-bit-8-bit-and-10-bit-I2C-Slave-Addressing#7bit"&gt;www.totalphase.com/.../200349176-7-bit-8-bit-and-10-bit-I2C-Slave-Addressing&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So when using the TWI driver in the SDK you need to shift the address one bit left and add the R/W bit as LSB before passing the resulting uint8_t variable to the TWI functions.&lt;/p&gt;
&lt;p&gt;If you write to the ADDRESS register directly, you can see in the data sheet that it consists of 7 bits, so no shifting is necessary.&lt;/p&gt;
&lt;p&gt;You do not need any external pull ups for the SCL and SDA. When the PSELSCL and PSELSDA registers are set the pins are configured correctly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25779?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2015 09:24:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67af5ff8-5745-44dd-94c5-fdb808c9b251</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;I am unable to read the data from the defined address from the slave device. After googling for a while i found that the address need to shifted to the right by 1in one post and in the other it said to the left by 1. Now i am confused to which side?  even if i figure out by hit and trial method. I am not sure why the address needs to be shifted out by 1.... Since, its nowhere mentioned in data sheet or any thing related to shifting of address. and do i need to pull up the pins of scl and sda ????&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI / I2c  device unable to read / write the device ?  irrespective of following reference manual.</title><link>https://devzone.nordicsemi.com/thread/25778?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 14:41:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb26f67d-8657-4ff7-8665-d23fabc9eaf6</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Why are you using the register addresses instead of the register names defined in nrf51.h? It makes your code really hard to read.&lt;/p&gt;
&lt;p&gt;There is a TWI driver in the SDK that you can use instead of making all the low level functions your self. &lt;a href="https://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v8.x.x/doc/8.1.0/s110/html/a00016.html"&gt;developer.nordicsemi.com/.../a00016.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also, can you please update your question with what is actually not working. If you are able to see any activity at all using a logic analyzer or oscilloscope, and your test setup in general. How do you know it doesn&amp;#39;t work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>