First off that IC is not a 5 volt tolerant device so you need to connect a level translator to bring the IO levels down to the supply voltage you're using on VDDIO.
Secondly, when using I2C you need to use the 7bit address for the IC, which in this case is 0x38. Next you need to uncomment the first Wire.endTransmission, because you need it, and then delete the second Wire.endTransmission() because you don't need it.
Also try reading the value from the Chip ID register, address 0x00, and it should return a 2, that way you know for sure you're communicating with the device.
the only question i have is, why is the adress 0X38 and not 0x70 as described in the datasheet?
It's actually both. The 8 bit address is 0x70 for a write operation and 0x71 for a read operation. Since the Arduino knows that bit 0 will toggle between 0 and 1 it has you only enter the 7 bit address (8 bit shifted to the right by one) for all I2C devices.
I try to run the sensor with your code, but I have some problems translating the output to decimal numbers. Can you please explain what you do to read the values?
The communication is working. If i read the address 0x00 it returns a 2.
i have to correct myself - Of Course the ic itself can NOT handle 5v - however i use the IC on a breakout board deliverd/made by elv which has the level translator on board.
Well if you're confident you have it wired up correctly and the above code is not returning a 2 then there may be something wrong with the sensor. I can see that your link has additional pins on the breakout board. Do you have a link to that schematic by any chance?
Ok... I wrote a little programm to run through all possible i2c adresses und requesting de 0 register... None of them returns a 2(what the bma020) is supposed to do....so it seems that the bma is not communicating on the bus at all.
Is there mistake in the wiring or the code i posted above? Its really starting to drive me crazy ,)
I have a feeling your problem may be the solder jumper J1 on the board. Looking over the schematic it looks like J1 should be shorted to provide logic level translation on the I2C lines. Looking at the picture of your board it looks like the jumper is open. Is there any documentation for the board that specifies if the jumper should be open or shorted?
the documentation / manufactureres website says that you close J1 when you are using exactly 2.5V.
which makes sense because then youve got 2.5V on Upullup. if you use 5V like me it should be left open.
which makes sense as well, because then the 2.5V come from the "Linearregler (2,5V)" from the upper right corner in the schematic...
yesterday i bought a wii mote plus with some gyros in it which communicates over i2c as well. ill let you know if this works
if not, probably there is something with my arduino?!