Pages: [1]   Go Down
Author Topic: BMA020 is always 0  (Read 709 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hy,

I try to read the acceleration from a Bosch BMA020 (http://www.elv.de/elv-3-achsen-beschleunigungssensor-3d-bs-fertiggeraet.html)

The DUE incessant reads 0 from the the module.
A test with the same code on a MEGA works pretty and delivers acceleration values.

Code:
#include <Wire.h>

#define BMA020_I2C_ADDR 0x38

void setup()
{
  Serial.begin(9600);
  Wire.begin();
 
  delay(200);
}

void loop()
{
  Wire.beginTransmission(BMA020_I2C_ADDR);
  Wire.write(0x02);
// Wire.endTransmission(false);
  Wire.requestFrom(BMA020_I2C_ADDR, 6);

 while(Wire.available() < 6);
 Serial.print("X: ");
 int tempLSB=Wire.read()>>6;
 int tempMSB=Wire.read();
 Serial.print( (tempMSB>>7)==0 ? tempLSB+((tempMSB&0x7f)<<2) : ((tempLSB>>6)+(tempMSB&0x7f)<<2)-512 );
 Serial.print("     Y: ");
 tempLSB=Wire.read()>>6;
 tempMSB=Wire.read();
 Serial.print( (tempMSB>>7)==0 ? tempLSB+((tempMSB&0x7f)<<2) : ((tempLSB>>6)+(tempMSB&0x7f)<<2)-512 );
 Serial.print("     Z: ");
 tempLSB=Wire.read()>>6;
 tempMSB=Wire.read();
 Serial.println( (tempMSB>>7)==0 ? tempLSB+((tempMSB&0x7f)<<2) : ((tempLSB>>6)+(tempMSB&0x7f)<<2)-512 );
 Wire.endTransmission();

 delay(200);
}


Has anyone a solution for that problem?

Thanx
lowsax
« Last Edit: May 24, 2013, 05:11:55 am by lowsax » Logged

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

It's becoming more strange.  smiley-confuse

While testing the signals with the oszi, it works.
Maybe of the capacity of the probe (100pF) on SCL to GND.
But after further tries, it also works with only probe connected to SCL (no GND). And later also with no oszi connected (just the probe, no GND).

Is there a known hardware problem of I2C?


Logged

White River Junction, Vermont USA
Offline Offline
Full Member
***
Karma: 5
Posts: 106
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Schematic?  Maybe something in the support circuitry of the Bosch BMA020 pcb?

I see the board has a wider voltage range than the BMA020 chip itself, so something must be going on there...

Also, be sure there are no external pull-up resistors activated on the I2C bus connected to the DUE.  The pull-ups are already included on the DUE, and are aggressively sized (on the small end).  Additional current due to improperly-sized external pull-ups will destroy the DUE's I2C hardware interface.  Anecdotally, I believe that I have destroyed DUE's TWI by just activating the TWI, and inadvertently leaving the logic states low on either/both of these pins, using the built-in pull-ups.

Maybe take a look at the link posted here:
http://forum.arduino.cc/index.php?topic=146802.msg1133641#msg1133641

FWIW: I have a I2C DUE system that works reliably with 13 addressable gateways, each with I2C subnets beyond.  So, the TWI hardware does work.  However, I do buffer the network.

Regards,

Chris
Logged

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

@Chris,

thanks for your ideas, but unfortunately it does not help.
The module which carries the BMA020 has a level shifter.
I have no external pull-ups (I know they are included on DUE).
I use several other I2C chips single and combined on the DUE.

What's not clear to me, why helps the oszi probe?
Now I use a 33pF SCL to GND. And it works.  smiley-surprise
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 230
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Chris,

thanks for your ideas, but unfortunately it does not help.
The module which carries the BMA020 has a level shifter.
I have no external pull-ups (I know they are included on DUE).
I use several other I2C chips single and combined on the DUE.

What's not clear to me, why helps the oszi probe?
Now I use a 33pF SCL to GND. And it works.  smiley-surprise

Sounds for me at all there is ground missing on the BMA020 may somewhere is the ground connection broken by some wire
Logged

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

@Markus_L811

Quote
Sounds for me at all there is ground missing on the BMA020 may somewhere is the ground connection broken by some wire

IMHO the wire could not be the problem, because all measures and the capacitor were connected directly on the DUE and not the BMA020.
On the other hand, a cap could not supply the BMA.
Measure of the wires results in low resistance and no short circuit.
Logged

Pages: [1]   Go Up
Jump to: