Pages: [1]   Go Down
Author Topic: MMA8452Q 3 axis accelerometer  (Read 1433 times)
0 Members and 1 Guest are viewing this topic.
Michigan
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone had any luck getting one of these to work with a Due? Works with my Uno R3 and Pro Mini, just not the due.
Logged

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

I have the same problem...but ADXL345, if have some news post here!!
Logged

Venezuela
Offline Offline
God Member
*****
Karma: 16
Posts: 509
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul F.
Are you using the two 4.7K pull-up resistors in SCL and SDA? Regards.
Logged

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

Tried to connect with two pull-up resistors.
Still not working.
Logged

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

Alchem,

Looks like the MMA8452Q has on-board 10K pull-ups already on the I2C lines (https://www.sparkfun.com/products/10955).

The Due already has very small pull-up resistors installed in its default I2C lines.

Adding any additional pull-ups results in a very good chance that you will destroy your DUE's SDA/SCL ports (in my experience, sometimes causing severe overheating of the chip).

If they exist, you should also remove the pullups on the MMA8452Q board.

Search the forum for I2C issues.

-Chris
Logged

Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It probably won't work because the MMA8452Q requires the use of a repeated start.  From what I can tell in the library, they did not implement (even though they set up the argument passed to endTransmission) it.

Code:
//
// Originally, 'endTransmission' was an f(void) function.
// It has been modified to take one parameter indicating
// whether or not a STOP should be performed on the bus.
// Calling endTransmission(false) allows a sketch to
// perform a repeated start.
//
// WARNING: Nothing in the library keeps track of whether
// the bus tenure has been properly ended with a STOP. It
// is very possible to leave the bus in a hung state if
// no call to endTransmission(true) is made. Some I2C
// devices will behave oddly if they do not see a STOP.
//
uint8_t TwoWire::endTransmission(uint8_t sendStop) {
// transmit buffer (blocking)
TWI_StartWrite(twi, txAddress, 0, 0, txBuffer[0]);
TWI_WaitByteSent(twi, XMIT_TIMEOUT);
int sent = 1;
while (sent < txBufferLength) {
TWI_WriteByte(twi, txBuffer[sent++]);
TWI_WaitByteSent(twi, XMIT_TIMEOUT);
}
TWI_Stop( twi);
TWI_WaitTransferComplete(twi, XMIT_TIMEOUT);

// empty buffer
txBufferLength = 0;

status = MASTER_IDLE;
return sent;
}
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Pages: [1]   Go Up
Jump to: