SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By ikorman
#116531
Hi

I have spend several days trying to connect accelerometer BMA180 breakout board to Arduino. I read several forums and topics regarding connecting those two components, followed all the instructions, but without any success. Here is how I connected the components (Arduino duemilanove, logic converter and BMA180):

Image

The code I'm using to probe the BMA180 is following:
Code: Select all
#include <Wire.h>
#define address 0x40

void setup()
{  
  Wire.begin();
  Serial.begin(9600);
  delay(2000);
  Serial.println ("Init done");
}

void readID()
{
  int temp, result, error;

  Wire.beginTransmission(address);
  Serial.println ("Wire.beginTransmission(address);");
  Wire.send(0x00);
  Serial.println ("Wire.send(0x00);");
  Wire.requestFrom(address, 1);
  Serial.println ("Wire.requestFrom(address, 1);");
  while(Wire.available())
  {
    temp = Wire.receive();
    Serial.println ("Wire.requestFrom(address, 1);");
  }
  Serial.print("Id = ");
  Serial.println(temp);
  result = Wire.endTransmission();
  
}

void loop()
{
  readID();
  delay(10);
}
It get's stuck at Wire.send(0x00) line. When I put instead BMA180 gyro MG1101 (also I2C runing on 3.3V) and use the same code (only change device address to 0x50) I can read gyro data. But BMA180 plays dead... :(

Did I missed something in wiring devices or can be that BMA180 is actually dead (40$ down the drains)? Just for reference I'm using arduino duemilanove and not uno (by mistake I used wrong image) and Arduino software version is 19.

Best regards
Ivan
#116563
Hi Ivan,

When you talk to the BMA180, try the simple stuff - address 0 and 1 have version and chip ID - they should return values immediately.

Are the supplies (5V and 3V) correct and stable to the interface board - are they supplying reasonable, expected current with the BMA180 attached.

If address 0 and 1 return the same value, you may have to shift your address one bit (some I2C divers use 7 bit, others 8 bit addressing...)

What test gear do you have to hand / can borrow / steal ?

Regards,

Mark
#116570
This is what I try to do: read chip ID but no luck. I2C code just gets stuck when sends first I2C command - like it's waiting for I2C ack from slave forever. I have PC scope available and I tried to use it here - problem is that I was not able to catch anything on data line while clock line is visible OK (with proper signal levels). This could be dough because of the way this cheap scope is working (HW/SW). Did try to measure before and after logic converter and nothing on SDA. Keep in mind that when I disconnect BMA and connect I2C gyro (same converter and arduino setup) I can read the data without any problem - exactly the same code, only different device address.

BR
Ivan
#116574
Hi Ivan,

Manufacturers sometimes vary how they represent I2C addresses, 0x40 from one can be 0x20 from another. Try 0x20, 0x21, 0x40, 0x41, 0x80 and 0x81. I think that covers all bit shift variants and a few more...

If you can figure out how to get the timeout to work, how abut an I2C scanner that scans address 1..127 and prints a * if an ack is found and a new line when address is modulo 16 etc.

I note that one of the accelerometer board pins sets I2C address and another mechanism selects between I2C and SPI. Check that these go where you think they should with an ohm meter.

I am surprised that the I2C routine doesn't have a timeout and everything just hangs.

Can you post a link to the level converter you are using.

Do you have pullups on the 3v3 side (1k ?) With the bus idle SCL and SDA should be a logic 1 on both sides

Regards,

Mark
#116594
Hi Ivan,

The logic converter you posted has pull downs on the RXD lines.

If the I2C gyro has pull ups, (which the BMA180 does not have) then this could be your problem.

Can you post data on the gyro ?

Did you go through the other suggestions ?

-Mark
#116601
markaren1 wrote:Hi Ivan,

The logic converter you posted has pull downs on the RXD lines.

If the I2C gyro has pull ups, (which the BMA180 does not have) then this could be your problem.

Can you post data on the gyro ?

Did you go through the other suggestions ?

-Mark
If you look at my schematic I'm using only TX channels as they are bidirectional and they have pull ups. I didn't have time to try other suggestions yet (long day in the office), but will try them soon.

Gyro I'm using is following: http://rtds.cs.tamu.edu/web_462/techdoc ... 20RevA.pdf. It's integrated into VR video headset.
#116609
After further investigation, I'm more and more convinced that breakout board is faulty. I noticed that when I connect sensor to logic converter SDA line immediately goes to 0. Then I figure out that GND or SDO (which has to be connected to ground) and SDA (purple) line are shorted. First I thought that I over solder somewhere, but after close inspection I could not find any short. The I decided to cut line between SDA pin out on breakout board and actual chip leg and there is no more short on breakout board pins, so short must be somewhere on chip side.

Image

After closer inspection (which was quite though as chip is only 3x3 mm) I have noticed that solder job is quite wonky - notice "huge" solder blob on one of the pins:

Image

It looks messy so there is quite a chance that something is shorted underneath it. Sad things is that if this is really true, I have put 40$ down the drain because of wonky PCB manufacturing process... :(
#116621
Hi Ivan,

Sounds like you are making progress, well done.

Email this thread to sparkfun and see if they would be kind enough to send out another board without putting your though the hassle of sending this one back - they seem like decent people to me. In any case, nothing ventured, nothing gained.

If they can't or won't help, get some de-solder wick, pull out all of the solder that you can, and have another go. Nothing to lose.

Failing that, ship it to me in New Zealand, and I will be happy to see if I can fix it. I have some spare time and some spare good spirit :)

Regards,

Mark
#116638
markaren1 wrote:Hi Ivan,

Sounds like you are making progress, well done.

Email this thread to sparkfun and see if they would be kind enough to send out another board without putting your though the hassle of sending this one back - they seem like decent people to me. In any case, nothing ventured, nothing gained.

If they can't or won't help, get some de-solder wick, pull out all of the solder that you can, and have another go. Nothing to lose.

Failing that, ship it to me in New Zealand, and I will be happy to see if I can fix it. I have some spare time and some spare good spirit :)

Regards,

Mark
I thing that it would be impossible to use de-solder wick on this little bugger - thing is soooo tiny. Anyway, I have contacted tech support and gave them reference to this thread, so we will see. In any case thank you for assistance and help :wink:

BR
Ivan
#126917
Sorry for the bump, but I'm having much the same problem as the OP. However I did get it (sort of) working.

I followed the wiring diagram above exactly, and I went and put in the i2cscanner.pde sketch I found at this link ( http://todbot.com/blog/2009/11/29/i2csc ... s-scanner/ ). On running, it froze up, which is what made me think that the BMA180 was holding the SDA line low. Anyway, when I went and pulled the link on SDO so that it was floating (ie, not tied to ground), the BMA180 started responding on i2c address 0x40 (ie, where it should).

Now, this doesn't make much sense to me. The BMA180 datasheet says that SDO is "SPI output (4-wire) or set-up of i2c address", and that for i2c it should be at GND or VDDIO. Page 63 on the datasheet shows SDO being tied to ground, which is the setup that doesn't work.

What's going on? I haven't as yet verified if SDI or SDO are shorted, but I don't think they are, otherwise surely I wouldn't have got a response from the i2c scanner (since the address of the BMA180 would toggle between 0x40 and 0x41 as data went over the i2c line, right?)
By jyoung
#127458
Update for those who come across this thread via Google;

It turned out that pin 6 and 7 on the breakout board were shorted, and it appeared that they were probably shorted under the BMA180 chip (my soldering job was fine on the pins, carefully examined it with a 10x magnifying glass).

The board was replaced, and now all works properly. Lesson to be learned here - check the board for shorts.