Jump to content


Photo

Issue with I2C and Wire


  • Please log in to reply
1 reply to this topic

#1 juani_c

juani_c

    Level 1

  • Members
  • 115 posts
  • LocationParanĂ¡-Entre Rios-Argentina

Posted 22 December 2015 - 09:32 PM

I'm trying to comunicate with a FXOS8700CQ. (Energia 13-MSP430G2553)

When I use this code:

 

Wire.beginTransmission(0x1E);   // Initialize the Tx buffer
Wire.write(FXOS8700CQ_OUT_X_MSB);                // Put slave register address in Tx buffer
Wire.endTransmission(false);       // Send the Tx buffer, but send a restart to keep connection alive


Wire.requestFrom(0x1E, 6);  // Read bytes from slave register address 
  i=0;
  while (Wire.available()) {
dest[i++] = Wire.read();
}
 
I get what it's seen in the bottom of the image. The second time the addres is sent it should be a "read" instead of "write".
When using just Wire.endTransmission();, that is whitout "false", the STOP is sent (top of the image), this is not how the communication with the sensor should be, BUT now the second time the addres is sent correct as a "read".
It's like the Wire.requestFrom() is not actually reading. Any ideas?
 
i2c.png

Improving my english a couple of words at a time...
http://ssihla.wordpress.com/

#2 energia

energia

    Level 4

  • Members
  • 950 posts


Posted 23 December 2015 - 07:18 PM

Hi @juani_c, this is what is called a repeated start. We have tried to implement this for the MSP430 but have not been able to get it to work reliably. We are still looking into it but it has been pushed down the list since the majority of the I2C sensors do not need a repeated start.

 

Robert


  • juani_c likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users