Go Down

Topic: MMA8452Q 3 axis accelerometer (Read 1 time) previous topic - next topic

Paul F.

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.

robertocarlos

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

Palliser

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

alchem

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

chriskner

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

wayneft

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: [Select]

//
// 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;
}
I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Go Up