I2C Testing software, making a test-setup.

Good day to you, whom is reading this!

I've got a slight problem which i'm currently unable to resolve, I'm designing a test-setup as a intern to test I2C PCB's.
Now that i've basicly completed the program, I'm getting a Time-Out at the end of my tests...
Knowing it's a bit hard for you guys to replicate, as you don't have neither the PCB running the software or the PCB's which are to be tested, I somewhat do hope that It's just a typo in my software.

One thing though, the comments in this software are mostly in Dutch... Though if necesarry I'll be able to translate it into English!

Current one I'm testing is the I2C Software, and then the sub catagory of the Interlock PCB.

Testsoftware_I2C_PCB.zip (19.9 KB)

Hi, welcome to the forum.

I can have a look at the code, but I would have to guess what the hardware is. Therefor I have many questions.

Is something printing the text "Time-Out" to the serial monitor ? Where is that time out ? Does it have anything to do with the I2C ? Which Arduino board are you using ? Do you have all 8 bits of PORTC for a parallel output ? That port is also used for I2C on a Arduino Uno. Which Arduino IDE version do you use ? Do you have pullup resistors for the I2C bus ?

I suggest to turn the i2c_scanner into a function and run that in the setup() function.
http://playground.arduino.cc/Main/I2cScanner
Every time you start the sketch, you know at least that the I2C is working.

The use of the Wire functions seems okay. I don't know if they are called from interrupts, but so far they seem okay.

Read:
...
  if (configread == 0x80) {                       //Als de RDY bit laag is dan is de ADC klaar met meten
    goto Read;                                     //Is de bit nog hoog dan nog een keer meten, netzolang tot hij laag is.
  }

Ugh. You can use a do ... while loop, you know.


I can't see anything obviously wrong. I would get rid of the String class myself. Maybe drop the I2C speed down.

Maybe you are running out of RAM. Change:

     Serial.print ("Test ");           //Print test

to:

     Serial.print (F("Test "));           //Print test

Ditto for every other place like that.

As Peter_n suggests, run an I2C scanner, I have one here:

If that doesn't help, test individual parts on their own. I don't usually attempt to get a big sketch to work until all the "black boxes" are individually tested.

I'm sorry for my late reply, i've got somewhat involved in multiple projects so distractions are all over the workplace right now :slight_smile:

I'll try to see if the RAM might indeed be the issue, if that works i'll let you know! And about those do... while loops, I see that's right.. Though the thing is that I didn't write the full code, I had it handed down to me halfway through a project from a intern (wich i'm myself too) who left.

And besides this he didn't leave a particular lot of helpfull info, which is quite the annoyance as you might understand.

Anyway, yes a bit more info would have been helpfull indeed!

Arduino Uno, 1.06 IDE.
And i'm actually using a side-program to run the test from, which due to company protocol i sadly cannot release, unless someone is willing to pay the fine :P.