I2C sweep check practically all numbers

Hi guys, first post here.

I've been trying to program an SSD1306 OLED I2C-based display and inevitably the topic on which address I should be using crops up. Obviously I haven't been able to even make the display flicker.

The connections were all made (Vcc, GND, SCK and SCL) on a Cytron ARM Cortex M0.

So I used the ubiquitous piece of code:

#include <Wire.h>

void setup() {
Serial.begin (9600);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;

Wire.begin();
for (byte i = 8; i < 120; i++)
{ Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1);
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
}

void loop() {}

And got this back:

Untitled

I got that a previous thread was discussing that maybe it's because of the SCK and SCL pins were floating. I've put the pullups with resistors and still nothing worked.

So.. fellow nerds.. hope you can help a brother out.

Thanks.

Can You show the schematics for all the powering of the project parts? Too often insufficient powering has been the reason in too many projects.

Hi Railroader,

It's pretty straightforward, exactly like the Arduino UNO connection like follows:
Wiring-Fritzing-Connecting-128x64-OLED-Display-Module-With-Arduino

Here's a pic of mine:

Only that the chip is an ARM Cortex M0.

I've checked the voltage across the Vcc and GND and it's all ok, 5V.

It worked with a servo previously so I doubt power is the issue though.

Vizier87

Hello V,
Something is wrong with your I2c Scanner. Please use one of the Examples from the Arduino IDE. They will give you a map of I2c addresses. How you show 112 devices is impossible with the schematic you show. I hope this helps. Maybe I missed something. You say SCK and SCL which are the same (Serial Clock) It should be SCK and SDA but I would have to look at a OLED display to check these connections and What are the labels. If i remember maybe SCL may be SDA.
Are you using a 0.96, 1.2 or a 1.5" display?

Hi Dave, sorry it was my mistake. I meant SCK and SDA.

I've used this snippet from the Playground and with similar results:

I am using a 0.96" 128x64 OLED LCD Display. Here's the link.

I've been looking around for a proper I2C library which I can import on my own but the one I got was actually just a dummy address-generated code. I'd appreciate it if someone can point me to the right I2C library.

Thanks everyone.
Vizier87

How compatible is that board ?
The processor is a NUC131LD2AE.
They say: "We have completed the fundamental Arduino Library for it (Require Developer to verify)".

I think that this board is not really usable.

Do you have pull ups on the I2C signals?

1 Like

The processor is a NUC131LD2AE.

What core do you use, and what board do you select?

{ Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)

There may be issues with the Wire library implementation with that board when a 0 length write is executed. Try sending some data.

I wouldn't get my hopes up, but you can try

{ Wire.beginTransmission (i);
Wire.write(1);
if (Wire.endTransmission () == 0)

Hi cattledog.

I'm sorry, but which part of the code should I insert this snippet?

Thanks.

Hi everyone. I've been going back and forth with the ones who developed the board, and it seems that you guys were right - the board is still in its beta stage.

They (the devs) tested it with their own setup and got the same results as mine, and suffice to say the support is no longer offered to troubleshoot this.

I'm pretty stuck to the processor (NUC131LD2AE) because it is one of the few affordable and small boards around with an 800 ksps ADC capability (I needed a high-speed ADC microcontroller for an application which had worked).

They tested it with some I2C-based displays which worked, (Grove 16x2 display) but that's about it.

My option at the moment is to debug the program/library until it works and I'll appreciate it if anyone can point me in the right direction.

Maybe beginning from the I2C library, I guess but I'm not sure where to start.

Anyone?

Hello Vizier,
Try this code. If x03c does not work then try 0x3d ?
Code from sample. I hope this is some help.


#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

// OLED display TWI address
#define OLED_ADDR 0x3C

Adafruit_SSD1306 display(-1);

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup() {
// initialize and clear display
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
display.display();

// display a pixel in each corner of the screen
display.drawPixel(0, 0, WHITE);
display.drawPixel(127, 0, WHITE);
display.drawPixel(0, 63, WHITE);
display.drawPixel(127, 63, WHITE);

// display a line of text
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(27,30);
display.print("Hello, world!");

// update display with all of the above graphics
display.display();
}

void loop() {
// put your main code here, to run repeatedly:

}


  • Top left pixel – x = 0, y = 0.
  • Top right pixel – x = 127, y = 0.
  • Bottom left pixel – x = 0, y = 63.
  • Bottom right pixel – x = 127, y = 63.

Thanks for the code.

I managed to make it work with a Software I2C scanner, from Seeed.

It's the generic 0x3C address as expected.

Here's the output:
Untitled

Now I think I may have to try and use the software I2C option in the library. Only that in the library, I'm not sure where the address is specified though?

Lemme do a bit more digging and I'll update if I find anything.

The Seeed library uses pinMode() and digitalRead() and digitalWrite() for the software I2C bus. Those simple functions should work, so also the Seeed I2C library should work.

The Seeed library is not fully compatible, as you can read in this list.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.