Hello,
I'm not sure if this is the right place to ask my question, but I'm not currently going through the I2C protocol of my TI chip "bq27750" (fuel gauge for battery status).
I have attached the manual to you... (Page 49 etc.)
For example, if I want to read the current voltage value, I understand the protocol as sending 0x55 as address, then sending 0x08 and 0x09 to get the correct register and then getting the answer. Is that right?
I have programmed the following code for this:
Wire.beginTransmission(0x55);
Wire.write(0x08);
Wire.write(0x09);
Wire.requestFrom(0x55, 2);
if (2 <= Wire.available()) { // if two bytes were received
reading = Wire.read(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.read(); // receive low byte as lower 8 bits
Wire.endTransmission();
Serial.println(reading); // print the reading
Serial.println("\n");
Serial.println(reading, DEC); // print the reading
}
else
{
Wire.endTransmission();
}
If I use this, I get the protocol from the attachment. (see picture)
It feels like the Arduino is twisting something or the chip is coming before my Arduino. Because you can see that the address is being sent, but first the Arduino goes into read mode and then into write mode to send the bytes. What am I doing wrong?
I just want to address the registers and then read out the values...
Manual.pdf (714 KB)
