Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Looking for some help with a hanging I2C program.  (Read 124 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have another thread more in line with my project in general, but I wanted to make one for this specific problem. I am trying to connect an magnetometer to my arduino Mega 2560. I have everything all nice and wired up (had the circuit double checked by a coupe different people). It is based off a diagram that another user and I agreed should work.

components: Arduino Mega 2560, LSM303C mag sensor, and level shifter

I am just trying out the I2C scanner sketch to check if everything is at least wired properly.
http://playground.arduino.cc/Main/I2cScanner

The code hangs in the first pass through the for loop once it reaches

error= wire.endTransmission();

I disconnected the circuit from the arduino and the scanner sketch ran fine, but the problem arose when I reconnected everything.
I have seen a couple threads with similar issues but details were never explained well enough for me to follow.

my sensor data sheet:
http://www.st.com/web/en/resource/technical/document/datasheet/DM00089896.pdf


I have a circuit diagram available to post if the need arises. Any suggestions on where to start with an issue like this?


Logged

Offline Offline
Edison Member
*
Karma: 49
Posts: 1855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I already told you  smiley-wink
If SDA and SCL are shortcut to each other or if one of them is shortcut to GND (perhaps also when shortcut to 5V or 3.3V), the endTransmission() is never completed.
Logged

An Arduino is an Arduino of course, of course. And no one can talk to an Arduino of course, That is of course, unless you upload your sketch

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But I loooooooked. Of course I may be an idiot and just did not spot the issue. Besides I have that multimeter you requested.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can take pictures of the actual circuit I built to give a best visual aid to how I built the darn thing.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I uh....I got it working........

Between the line from SDA to the 3.3V rail I added in a 4.7k resistor. Repeated it for SCL.

The 7 bit address of my sensor is 0x1E....I2C scanner returns device at 0x1E!!!!!!!


Though one weird thing is it is also saying I have a device at 0x1D. But that only shows up on the iteration 2+ in the for loop.
« Last Edit: August 13, 2014, 12:50:50 pm by GettingAlong » Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: