<?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>OLED 2864 I2C communication help..</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5140/oled-2864-i2c-communication-help</link><description>I try to trun on the Display 
 uint8_t Setting [20] = {0xA8, 0x3F, 0xD3, 0x00, 0x40, 0xA0, 0xA1, 0xC0, 0xC8, 0xDA, 0x02, 0x81, 0x7F, 0xA4, 0xA6, 0xD5, 0x80, 0x8D, 0x14, 0xAF}; 
 int main(void)
{
nrf_delay_ms(400); 
 if(twi_master_init()) // twi_master_init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Jan 2015 15:31:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5140/oled-2864-i2c-communication-help" /><item><title>RE: OLED 2864 I2C communication help..</title><link>https://devzone.nordicsemi.com/thread/18034?ContentTypeID=1</link><pubDate>Thu, 29 Jan 2015 15:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f596e60-b4de-4f87-a1c6-aaeb63acf931</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;ul&gt;
&lt;li&gt;I assume when you write &amp;#39;Non&amp;#39;, you mean not connected. So: Reset (RES) is active high, and ChipSelect (CS) is active low.&lt;/li&gt;
&lt;li&gt;You need to shift the address 1 bit
left, since the address is 7 bits and
the last bit is the R/W bit (As
written in section 8.1.5.2 in the
SSD1306 documentation, R/W bit should
be 0 when writing):&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;twi_master_transfer( ( 0x3C &amp;lt;&amp;lt; 1 ), data, length, stop_condidtion)
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;If you look at the TWI data format in figure 8-7 in the SSD1306 documentation, there is a &lt;strong&gt;control byte&lt;/strong&gt; before the &lt;strong&gt;data byte&lt;/strong&gt;, which tells if the data byte is a Command or Data. Further, the flow diagram you included in your post for initializing the display shows it needs a command first and then the data for that command. For example, the first &amp;#39;Set MUX ratio&amp;#39; command (A8h, 3Fh) would need to be sent like this (maybe):&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DATA1[2] = {0b10000000, 0xA8};
DATA2[2] = {0b11000000, 0x3F};
twi_master_transfer( ( 0x3C &amp;lt;&amp;lt; 1 ), DATA1, 2, false);
twi_master_transfer( ( 0x3C &amp;lt;&amp;lt; 1 ), DATA2, 2, true);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First the D/C bit is 0 to indicate a command, then a 1 to indicate data. This is just how I think it should be done after reading the datasheet for a few minutes, and it may be wrong. But it&amp;#39;s all written in the data sheet.&lt;/p&gt;
&lt;p&gt;Just want to say that the code you wrote will send one byte of data, and then issue a stop condition, regardless of it being a command or not. And it doesn&amp;#39;t seem right to me if you read section 8.1.5.1 in the datasheet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>