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.

BQ76972: I2C scan device address read

Part Number: BQ76972


Tool/software:

Hello TI team,

I have attached the I2C scan device code that will scan the devices which are connected on the I2C channel. But if I write the data on the same channel it doesn't work

Thank you, 

// To find the device address //
void I2C_ScanBus()
{
    char msg[64];
    uint8_t devicesFound = 0;

    for (uint8_t address = 1; address < 127; address++)
    {
    	HAL_GPIO_WritePin(MCU_BMS_RESET_GPIO_Port, MCU_BMS_RESET_Pin, GPIO_PIN_SET);
    	HAL_Delay(100);
    	HAL_GPIO_WritePin(MCU_BMS_RESET_GPIO_Port, MCU_BMS_RESET_Pin, GPIO_PIN_RESET);
    	HAL_Delay(100);
        if (HAL_I2C_IsDeviceReady(&hi2c3, address << 1, 3, 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);
    }
}

  • Hi Harsh, 

    Please refer to the Technical Reference Manual (https://www.ti.com/lit/ug/sluuby2b/sluuby2b.pdf) for instructions about the register and how to communicate with the device. We can answer specific question about the device, however we expect our customer to be able to review/debug their code. If you have an issue with the microcontroller, please reach out to the MCU team. If you have a specific question about the TRM, please post another thread with the same. Thank you. 

    Regards, 

    Arelis G. Guerrero