keys oled odd i2c issue

I have been stuggling to get a simple keyes oled module to function.
module is a https://www.fasttech.com/products/0/10011357/1977809-0-96-oled-high-clear-module-board-for-arduino

At first I figured it was a code or address problem but I had tried UG8LIB, adafruits ssd1306 library and just good old Wire and all left me with the same random garbage on the display.

I tried 3.3v and 5v power and was almost at the point of concluding I had a dodgy display when I connected a little saleae (clone) logic analyser to the i2c to probe the lines and magically the display then worked fine with all the assorted test codes.
once initialised, you can unplug the logic analyser and it will continue to run hassle free with no visible corruption. so it seems to be just the initialisation commands that are being received incorrectly.

now on the same i2c lines I also have a compass chip. this has worked fine.
the compass (GY-273 module) has an onboard 3.3v reg and the i2c pullups on it are 5.1k to the stepped down 3.3v.

the LCD module claims to be ok on 5v and it has pullups of 10k to the 5v rail.

It works with or without the compass module attached with the logic analyser, all that needs to be probed is the clock line, data is not required.

ACK is being received fine whether or not the init code has functioned.
I added a result error check on wire.transmit ..

byte result = Wire.endTransmission(); // stop transmitting
if (result) Serial.print(result);

and this never prints so long as address is correct.

at one stage I attached some long wires to the clock to a variable resistor wheel and the lcd would init fine when 47k to ground was selected, soldering a 47k resistor between SCLK and ground however proved fruitless.

soldering a 200pF cap between SCLK and ground means lcd will not init with or without logic analyser, still error free i2c comms though, at least the ack is received for the correct address.

I am now pretty much at a loss on what is actually going astray. scope puts clock rise times at 320nS and peak of 3.7v with or without the saleae attached. I can not see any change to the clock, its not noisy, looks fine.

any ideas to try ?
I am considering bit banging the i2c to see if I can track it down..
I was going to write some data to the lcd and then read it back as a test but the ssd1306 data specifies that " No data read is provided in serial mode operation. "

simply using an arduino nano hanging in mid air powered off the USB, the lcd connected via standard 6" wires, I separated the clock and data lines from the 4 wire loom to see if crosstalk was a problem.
I see people mentioning wire lengths of many metres running 100kHz i2c so I do not think they are the problem..

I just took the 3.3v from the compass module and am using that to power the LCD, added a 1uF cap between vcc and ground. display now will not init with or without analyser connected.

tried adding a delay up to 1mS after every i2c transmit.

this is doing my head in..
Now i do not even care what is wrong, I just want it sorted so i can move on..

Hi

I can only speak for U8glib. I can confirm that i had similar effects when dealing with inexpensive OLEDs. Sometimes, these OLEDs just don't work with a specific kind of power and logic levels. Please note that sometimes, the logic level also has an influence. So it may work with 3V and 5V power supply, but not with Due because of its 3.3V Logic levels.

But i think in your case it is more a reset or wire issue.

You could do this with u8glib:
Try the I2C option: U8G_I2C_OPT_NO_ACK instead of U8G_I2C_OPT_NONE
You could also call u8g.begin() after a delay of one second or so to resend the init sequence.

Oliver

Thanks for reading and considering it..

Things I have tried tonight...

I am not using the U8Glib library at the moment, I did try all 3 versions of the I2C at both 5v and 3.3 with no luck.

There is no reset line on the OLED, this is a 4 pins I2C only version.
I have tried initialising immediately, after a delay, in a loop every few seconds.
I installed a bit banged I2C (SoftI2CMaster) that was running at 6kHz instead of 100kHz, same problem so I have gone back to the faster version.
I inserted delays here and there, checked the timing etc.

The oled module can run off 3.3v as well, I have tried that. no difference, this is the really confusing one for me as I can see no reason at all in this case. From all the mucking around with various libs and speeds it odes not appear to be a timing issue but more the way the oled handles 5v/3.3v .. ut I simply cannot get it to function on any voltage.

The I2C master vcc voltage should not matter as it never pulls the pins high only allows the pull ups to operate. So the rail voltage of the module is the more critical facter as the pullups are there..
Using a 5v vcc the logic levels are hitting 3.7v, with or without the saleae. (due to the onboard 10k pullups on the module to vcc). I would assume
I thought perhaps there was a latch up issue on the ssd1309 data lines but I simply get the same result with a 3.3v rail.
Using a 3.3v vcc the logic is topping out at around 3.2v or so.

I have gone through the init code with a fine toothed comb.
I am confused as to why adafruit write 0x40 as the arguement for command 0xDB (SETVCOMDETECT) there is no explanation in the data as to what that value does.

I tried disabling the on board charge pump to see if it is a noise or power draw problem.

I tried a range of series resistors between the micro and the module. 100R/1k ..
I tried a range of resistors on the clock and data lines for both a pull up and a pull down. 1k to 100k.

I wish I had at least one more of these modules to try out, perhaps it is simply the one I bought to test first before buying more possibly.

Its just so frustrating seeing it work perfectly at times and then get nothing when disconnected from the saleae.

The odd thing is that I can make a loop and turn display on/ display off and the thing will sit there and quite happily do it all night. its an 8 bit command and its obviously receiving it just fine. I just cant tie down where in the init code everything falls apart without being able to interrogate the thing.

One area that has me really baffled is that if I made a sketch that writes some text every 100mS or so, then every second runs the full init code.
If I plug in the logic analyser then it will work fine, I can unplug the analyser and it will continue to work.
If I boot it up without the analyser connected then it will not work even if it is connected afterwards.

So it almost looks like something needs to be done immediately after power up or only functions once..

2 nights on this is enough, I am putting it aside till I get another one at least to find if it is perhaps just a dodgy one.
I see other versions of this module have an onboard regulator. That may make a difference.

Well, yes, could be a faulty OLED. Maybe you should also consider to buy the SPI version of a SSD1306 OLED. They often come with a reset line. I also felt, that SPI is more reliable...

Oliver