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.

BQ25622E: BQ25622e

Part Number: BQ25622E
Other Parts Discussed in Thread: BQSTUDIO

Tool/software:

Dear Texas Instruments Engineering Team,

We are developing a new product and have integrated the BQ25622e into our design. However, when we read the register values that indicate the charging voltage and current, we notice that the readings appear uncalibrated.

Please advise if any adjustments need to be made to these values or if we should follow a different procedure to obtain accurate readings.

Thank you for your support.

Best regards,
Fabiano Fruett

  • Hi Fabiano, 

    Thank you for reaching out via E2E. Please see my comments below. 

    The battery monitoring ADC of the BQ25622E device is offered as an extra feature in addition to the regular charger and is for reference only without accuracy specs. If you require highly accurate ADC measurements use of a gauge device is recommended.

    Given the above statement there is no procedure for calibrating the BQ25622E ADC. Although in general the ADC outputs for charge voltage and current should not have significant error. What are the charge voltage and current values the device outputs compared to the actual charge current and bat pin voltage? 

    Best Regards,

    Garrett

  • Hi Garrett,

    Thank you for your previous clarification. Following up on our observations with the BQ25622E, we are still encountering some issues while reading the VBUS and IBAT registers, which are returning no values.

    Here are some details based on our tests:

    1. Registers and Little Endian Format:

      • We are working with the BQ25622E in little endian format, as described in the datasheet. The VBAT register (0x30) seems to function properly, and we can retrieve values and calculate the battery voltage. However, the VBUS (0x2C) and IBAT (0x2A) registers do not return valid readings, even though we are following the same procedure used for VBAT.
    2. Current Code Setup:

      • For VBAT, we retrieve data, discard the 4 reserved bits, and apply a calibration factor. The battery voltage readings appear accurate. However, the VBUS register seems unresponsive, and IBAT does not provide a valid current reading despite using the correct 16-bit conversion.
    3. Initialization and Configuration:

      • The BQ25622E is initialized, and the current limit is set to 480mA (0x02 register configured with [0x01, 0x80]). The device seems to be operating normally otherwise. Still, we are unsure if any additional configuration is required for these specific registers.
    4. Clarification Requested:

      • Could you confirm if there are any specific conditions, configurations, or procedures required to obtain valid readings from the VBUS and IBAT registers? Additionally, is there any expected issue with the ADC accuracy that might prevent us from retrieving these values?

    We appreciate your help and are looking forward to any guidance you can provide to resolve this issue.

    Best regards,
    Fabiano Fruett

    Following this is the code in Micropython we are using in this application:

    from machine import I2C, Pin, SoftI2C, Timer
    from ssd1306 import SSD1306_I2C
    import bitdoglab
    from time import sleep

    # BitDogLab initialization
    bitdoglab.init()

    # Global variable to count the seconds
    timer_count = 0

    # Button configuration
    button_a = Pin(5, Pin.IN, Pin.PULL_UP)
    button_b = Pin(6, Pin.IN, Pin.PULL_UP)

    # Configure I2C for communication with BQ25622E
    i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=100000)
    endereco_bq25622e = 0x6B # I2C address of BQ25622E

    # OLED configuration
    i2c1 = SoftI2C(scl=Pin(15), sda=Pin(14))
    oled = SSD1306_I2C(128, 64, i2c1)

    # Function to read from a register
    def ler_registrador(endereco, registrador, nbytes):
    return i2c.readfrom_mem(endereco, registrador, nbytes)

    # Function to read the battery voltage (VBAT_ADC)
    def ler_vbat():
    # Calibration constant
    CALIBRATION_FACTOR = ((3.96 / (4095 * 1.99 / 1000))/2) # Adjustment based on the maximum ADC reading and measured voltage

    registrador_vbat = 0x1E # Address of the VBAT_ADC register
    dados_vbat = ler_registrador(endereco_bq25622e, registrador_vbat, 2)

    # Convert to little-endian and adjust the bits
    vbat = (dados_vbat[1] << 8 | dados_vbat[0]) >> 4 # Convert to 12 bits, discarding the 4 reserved bits
    tensao_bateria = vbat * CALIBRATION_FACTOR # Convert to volts and apply calibration factor

    print("VBAT Data (byte 0):", dados_vbat[0])
    print("VBAT Data (byte 1):", dados_vbat[1])
    print("Adjusted VBAT value:", vbat)

    return tensao_bateria

    # Function to read the bus voltage (VBUS_ADC)
    def ler_vbus():
    registrador_vbus = 0x2C # Address of the VBUS_ADC register
    dados_vbus = ler_registrador(endereco_bq25622e, registrador_vbus, 2)

    # Convert to little-endian and adjust the bits
    vbus = (dados_vbus[1] << 8 | dados_vbus[0]) >> 4 # Convert to 12 bits, discarding the 4 reserved bits
    tensao_barramento = vbus * 3.97 / 1000 # Convert to volts (LSB = 3.97 mV)

    print("Adjusted VBUS value:", vbus)

    return tensao_barramento

    # Function to read the battery current (IBAT_ADC)
    def ler_ibat():
    registrador_ibat = 0x2A # Address of the IBAT_ADC register
    dados_ibat = ler_registrador(endereco_bq25622e, registrador_ibat, 2)

    # Convert to little-endian and adjust the bits
    ibat = (dados_ibat[1] << 8 | dados_ibat[0]) # Convert to 16 bits
    corrente_bateria = ibat * 4 / 1000 # Convert to amperes (LSB = 4 mA)

    return corrente_bateria

    # Main function to display the readings on the OLED
    def exibir_leituras():
    tensao_bateria = ler_vbat()
    tensao_barramento = ler_vbus()
    corrente_bateria = ler_ibat()

    # Update the OLED display
    oled.fill(0) # Clear display
    oled.text("BitDogLab", 0, 0)
    oled.text("Unicamp 4.0", 0, 10)
    oled.text(f"Vbus: {tensao_barramento:.2f} V", 0, 20)
    oled.text(f"Vbat: {tensao_bateria:.2f} V", 0, 30)
    oled.text(f"Ibat: {corrente_bateria:.2f} A", 0, 40)
    oled.show()
    sleep(1)

    # Display the values in the console
    print("Bus voltage VBUS: {:.2f} V".format(tensao_barramento))
    print("Battery voltage VBAT: {:.2f} V".format(tensao_bateria))
    print("Battery current IBAT: {:.2f} A".format(corrente_bateria))

    # Function to handle interruptions
    def interruption_handler(timer):
    global timer_count

    # Check if both buttons are pressed
    if button_a.value() == 0 and button_b.value() == 0:
    timer_count += 1
    else:
    timer_count = 0 # Reset the count if any button is released

    # If both buttons are pressed for 3 seconds or more
    if timer_count >= 3:
    # Turn off the battery charger
    i2c.writeto_mem(endereco_bq25622e, 0x18, bytes([0x00]))
    print("Battery charger turned off")

    # Initialization class to configure the system
    class Init:
    def __init__(self):
    # Set the current limit to 480mA: 6 << 6 (6*80mA shifted by 6 bits)
    i2c.writeto_mem(endereco_bq25622e, 0x02, bytes([0x01, 0x80]))

    # Set up a timer for periodic interruptions every 1 second
    soft_timer = Timer(period=1000, mode=Timer.PERIODIC, callback=interruption_handler)

    # Initialize the system
    init_system = Init()

    # Run the main function
    exibir_leituras()

  • Hi Fabiano, 

    Thank you for your response. Please see my comments below. 

    1) & 2) The manner to read from ADC output registers is expected to be the same between REG0x30, REG0x2C, REG0x2A, etc. Please be aware the number of reserved bits is not consistent between VBUS, IBAT, and VBAT registers. Maybe that is related to your observation of correct VBAT value while VBUS and IBAT do not match expectation.

    Can you please help to share the raw 16 bit binary values for VBUS output (REG0x2C) and IBAT output (REG0x2A), as well as, the hardware measured values you are comparing against for VBUS and IBAT? 

    Additionally, if you are not using already I would like to share we have a GUI tool in BQSTUDIO which is useful during software development (can be downloaded from TI.com, link here: https://www.ti.com/tool/BQSTUDIO). The GUI performs the conversions for all ADC outputs, so you can use it to check if your code implementation matches. As an example the below image shows VBUS_ADC output in binary and voltage value. 

    3) I can confirm hex value 0x180 for 16 bit REG0x02 (i.e. REG03 = 0x01 and REG02 = 0x80) is correct to set ICHG = 480mA. Please be aware ICHG sets the fast charge current value, but IINDPM set in REG0x06, is the appropriate value for setting the input current limit for the buck converter. 

    Still, we are unsure if any additional configuration is required for these specific registers.

    The BQ25622E is able to function and charge a battery with default register configuration. Therefore, in general no additional configuration is required. Specifications related to proper charging of your specific battery or system level requirements may dictate needing to make additional register configurations.

    4)To obtain valid readings from VBUS and IBAT registers you simply need to enable ADC by setting ADC_EN = 1 (REG0x26[7] = 1). You also need to make sure you have not disabled these channels in REG0x27 (All ADC channels are enabled by default). You may not initially see valid readings if you attempt to read too quickly. I recommend implementing at least approx. 50msec of delay between enabling ADC and attempting to read to ensure ADC conversion has completed. 

    Best Regards,

    Garrett