Problem with I2C Oled and Wire.begin()

Hi,

I have an small I2C oled SSD1306, that works perfectly when i use the different examples of the library u8x8, under arduino nano board and Arduino 1.6.13 environment. I use this library because i only need to show text on the screen, and i do not have so much free memory for my project.

In my code i declared the library in this way "SSD1306_128X64_NONAME_SW_I2C u8x8(SCL,SDA, U8X8_PIN_NONE);"

Now, i am trying to add the screen to one of my projects that use "Wire" and "dallas temperature" libraries, and use two external eeproms to save some data.

The problem i discovered is that "u8x8" and "wire" libraries have some interactions that result in a not working Oled.

In pseudocode, when i do this:

u8x8.begin();
u8x8.drawString(6,6,"text1");
wire.begin()
u8x8.drawString(6,6,"text2");

the display shows the Text 1, but not the text 2. I know it, because the text do not change anymore.

In pseudocode, if i do this:

wire.begin()
u8x8.begin();
u8x8.drawString(6,6,"text1");
u8x8.drawString(6,6,"text2");

the display never shows text (neither text 1 and text2). So, i interpret that both libraries produces problems when working together.

I do not use pull up resistances on the I2C lines.

Do you have any idea about how could i solve this? Thanks in advance.

See the u8g2 FAQ: u8g2/faq.txt at master · olikraus/u8g2 · GitHub

Usually your problem will be solved by using:
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE);

Oliver

I noticed it has to do with the clock frequency. The Wire library uses 100000Hz as default, while u8x8/u8g8 use 400000Hz. When you use separated bus pins it is solved of coarse, but that is not the idea of a bus architecture, right?

The u8x8 can be set to 100kHz with the following command;
u8x8.setBusClock(1);

Then both devices work on the same bus.