bq24735 I2C communication
Posted: Fri Dec 02, 2022 4:51 pm
Dear all,
I am trying to setup the bq24735 power management unit with ESP32-WROOM-32.
I have a problem with writing information to the BQ_CHARGE_OPTION_REG. Here is a recording from the logical analyzer: The NACK is the problem. According to the datasheet write sequence should be this: Here is the code. The i2c_init(); happened successfully.
bq24735 datasheet:
https://www.ti.com/lit/ds/symlink/bq247 ... e.com%252F
Does anyone have a soolution to this? Or are there any bq libraries already implemented?
I am trying to setup the bq24735 power management unit with ESP32-WROOM-32.
I have a problem with writing information to the BQ_CHARGE_OPTION_REG. Here is a recording from the logical analyzer: The NACK is the problem. According to the datasheet write sequence should be this: Here is the code. The i2c_init(); happened successfully.
- #define BQ_SLAVE_ADDR 0x12 >> 1
- #define BQ_CHARGE_OPTION_REG 0X12 >> 1
- #define I2C_MASTER_PORT I2C_NUM_0
- #define I2C_MASTER_TIMEOUT_MS 300
- void app_main(void) {
- ESP_ERROR_CHECK(i2c_init()); //init is OK
- uint8_t chargeOption[3] = {BQ_CHARGE_OPTION_REG, 0xf9, 0x82};
- ESP_ERROR_CHECK(
- i2c_master_write_to_device(I2C_MASTER_PORT, BQ_SLAVE_ADDR, chargeOption, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS));
- }
https://www.ti.com/lit/ds/symlink/bq247 ... e.com%252F
Does anyone have a soolution to this? Or are there any bq libraries already implemented?