Skip to main content
Associate III
May 14, 2025
Question

I2C communication with BQ7697202 battery monitor

  • May 14, 2025
  • 3 replies
  • 1140 views

Hello Community,

I’m currently working with an STM32G4 MCU and the BQ7697202 BMS IC, and I’m trying to establish basic I2C communication between the two. According to the BMS IC datasheet, I’ve configured the I2C address correctly, but I’m still unable to detect the IC on the bus.

Additionally, I implemented an I2C scan to search for available devices, but the scan returns “No device found.” Please find the attached I2C configurations for the reference.  

Any guidance or suggestions would be greatly appreciated.

Thank you!

 

i2c_config-1.PNG

i2c_config-2.PNG

3 replies

Andrew Neil
Super User
May 14, 2025

Welcome to the forum.

Please see How to write your question to maximize your chances to find a solution for best results; in particular, please provide full hardware details and show your code.

 

Have you used an oscilloscope to verify your I2C waveforms? In particular, this will show if you have pullup problems.

Have you used an analyser (or the scope) to verify your I2C comms?

 

PS:

The BQ7697202 is a TI product - nothing to do with ST.

https://www.ti.com/product/BQ76972

Have you posted on their forums to verify your setup?

https://www.ti.com/product/BQ76972#support-training 

You could post your analyser trace there for their comment ...

 

PPS:


@harshpanchal_6 wrote:

I implemented an I2C scan to search for available devices, but the scan returns “No device found.” 


Have you tested it with any other I2C devices?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
May 14, 2025
void I2C_ScanBus()
{
 char msg[64];
 uint8_t devicesFound = 0;

 for (uint8_t address = 1; address < 127; address++)
 {
 if (HAL_I2C_IsDeviceReady(&hi2c3, address << 1, 1, 10) == HAL_OK)
 {
 snprintf(msg, sizeof(msg), "Found I2C device at 0x%02X\r\n", address << 1);
 RS485_Transmit((uint8_t*)msg, strlen(msg));
 devicesFound++;
 }
 }

 if (devicesFound == 0)
 {
 RS485_Transmit((uint8_t*)"No I2C devices found\r\n", 23);
 }
}
TDK
Super User
May 14, 2025

Ensure pullups in the 1-5 kOhm range are present on SDA and SCL. Internal pullups are not sufficient.

Ensure pins are wired correctly.

Ensure target board is powered.

Show pictures of setup.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate III
May 15, 2025

Duplicate merged.

Please don't start multiple threads on the same topic.


Can you please review my code and suggest me any changes. Your help will be appreciated.

 

#define BQ76972_I2C_ADDR (0x10 << 1)

// Reads 1 byte from BQ76972 register
HAL_StatusTypeDef BQ76972_ReadReg(uint8_t regAddr, uint8_t* data) {
 return HAL_I2C_Mem_Read(&hi2c3, BQ76972_I2C_ADDR, regAddr, I2C_MEMADD_SIZE_8BIT, data, 1, HAL_MAX_DELAY);
}

// Writes 1 byte to BQ76972 register
HAL_StatusTypeDef BQ76972_WriteReg(uint8_t regAddr, uint8_t data) {
 return HAL_I2C_Mem_Write(&hi2c3, BQ76972_I2C_ADDR, regAddr, I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
}
void BMS_ReadAndSend()
{
 uint8_t regVal = 0;

 if (BQ76972_ReadReg(BQ76972_I2C_ADDR, &regVal) == HAL_OK)
 {
 snprintf((char*)dataBuf, sizeof(dataBuf), "BQ76972 Reg 0x00 = 0x%02X\r\n", regVal);
 RS485_Transmit(dataBuf, strlen((char*)dataBuf));
 }
 else
 {
 RS485_Transmit((uint8_t *)"BQ76972 I2C Read Fail\r\n", 24);
 }
}

 

Andrew Neil
Super User
May 15, 2025

Please don't start multiple threads on the same topic.

You still haven't answered the questions I asked earlier:

  1. Have you used an oscilloscope to verify your I2C waveforms? In particular, this will show if you have pullup problems.
  2. Have you used an analyser (or the scope) to verify your I2C comms?

Have you followed @TDK's suggestions? What were the results?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
May 15, 2025

Yes, already tested