Tool/software:
Hi everyone!
I a soft dev working with haptic devices for VR games.
Lately, I was given new PCBs that integrate BQ25622 chargers so i can read battery voltage.
I managed to activate the ADC controller via I2C protocol, read the binary values and turn them in understable values. (Using ESP-IDF)
But i noticed variations in the amperage when plugins the charger.
When doing nothing, my battery charges at 1A (which is normal)
When enabling ADC Control via I2C bus (so i can read battery voltage), my battery charges at 0.5A
When reading Battery voltage via I2C bus (every 3 seconds), my battery charges at 0.1A
Is this normal behavior ? (If so, i just need to disable ADC control and battery reading when charging)
If not, is it more likely that i messed up the I2C dialogue or could it be coming from the PCB's architecture itself ? (I'm not an electronician, so I may not understand some things about hardware)
Here is how i set up I2C bus and enable ADC control
// Config i2c i2c_config_t conf; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = SDA; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = SCL; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = 1000000; i2c_param_config(I2C_NUM_0, &conf); i2c_driver_install(I2C_NUM_0, conf.mode, 0, 0, 0); i2c_cmd_handle_t cmdConfig = i2c_cmd_link_create(); i2c_master_start(cmdConfig); i2c_master_write_byte(cmdConfig, (0x6b << 1) | I2C_MASTER_WRITE, 1); // on donne l'adresse du device i2c_master_write_byte(cmdConfig, 0x26, 1); // on donne l'dresse du registre (adresse de l'adc) i2c_master_write_byte(cmdConfig, 0xB0, 1); i2c_master_stop(cmdConfig); i2c_master_cmd_begin(I2C_NUM_0, cmdConfig, pdMS_TO_TICKS(1000)); i2c_cmd_link_delete(cmdConfig);
And here is how I read my VBAT value :
i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_WRITE, 1); // device address i2c_master_write_byte(cmd, reg, 1); // register address i2c_master_start(cmd); i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_READ, 1); // device address i2c_master_read(cmd, data, 2, I2C_MASTER_LAST_NACK); // reading value i2c_master_stop(cmd); i2c_master_cmd_begin(I2C_NUM_0, cmd, pdMS_TO_TICKS(1000)); i2c_cmd_link_delete(cmd);
So far, i am able to read accurate battery voltage values (which is why i think i set up I2C correctly, I assume i would never get meaningful values if i hadn't)
The only issue is that my battery now charges at 0.1A instead of 1A
Thanks people !