This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ25756: I2C

Part Number: BQ25756
Other Parts Discussed in Thread: BQ25750

Tool/software:

Hello

Im trying to read the default set charge current from the I2C register with Arduino.

This is my code:

// Include the Wire Library
#include <Wire.h>
uint16_t data;

void setup() {
Serial.begin(9600); // Start seriel
Wire.begin(); // Init I2C
}

void loop() {

// Reading
Wire.beginTransmission(0x6B);
Wire.write(0x2);
Wire.endTransmission();
Wire.requestFrom(0x6B,2,true);

// Read the two bytes and combine them into a 16-bit value
data = (Wire.read() | Wire.read() << 8) & 0b0000011111111100; // Mask to keep bits 2-10

// Output the result (binary and decimal)
Serial.println(data, BIN); // Print binary value
Serial.println(data); // Print decimal value

}

My output is:

Binary: 

11001000000

Decimal:
1600

I think this is not right? In my opinion the register should be set to 400(decimal)?

Thanks.

Silvan

  • Hello Silvan,

    Yes, this is correct. The default value of register 0x02 is 0x640. This means that the ICHG_REG is 0x190 or 20A.

    By the way, we have this driver for the BQ25750 that may help. File: BQ25750_FreeRTOs_Driver.zip

    Best Regards,
    Ethan Galloway

  • Hello Ethan

    But why is the default value not 0x190, I mean is this 0x640 just a random number to show that the current is at max? 

    I never used such drivers, what can I do with this? 

    Thanks

    Silvan 

  • Hello Silvan,

    But why is the default value not 0x190, I mean is this 0x640 just a random number to show that the current is at max? 

    It's two different ways to look at the register. If we look at the register map in the datasheet below:

    We see that 2 bits from the top and bottom are reserved and are always 0.

    0x190 is the value that you get if you read the whole register. 0x640 is the value you'll get when you only read the ICHG register bits.

    Let me know if you have any questions about this.

    Also, for the driver, you can compile the driver and then upload the driver to a compatible microcontroller. You can also use the copy and paste sections of the driver to use for your own code.

    Best Regards,
    Ethan Galloway