Go Down

Topic: I2C Testing software, making a test-setup. (Read 28 times) previous topic - next topic

Mar 31, 2015, 09:13 am Last Edit: Mar 31, 2015, 09:15 am by HendrikNL
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.


Peter_n

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.

Nick Gammon

Code: [Select]

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:

Code: [Select]
     Serial.print ("Test ");           //Print test


to:

Code: [Select]
     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:

http://www.gammon.com.au/i2c

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy