Other Parts Discussed in Thread: BQ25892,
Hi,
I am trying to configure bq25892 battery charger with cc2640 i2c interface. But I am facing one issue when ever i update values and try to to read them for the first time I am getting correct values which i updated but next time i try to read the same value it reads default value.
static uint8_t REG04[2] = {0x04,0x2C}; //0x04 is REG04 of battery charger and 0x2C is fast charge current limit settings
static void Battery_charger_init()
{
i2c_status = bspI2cOpen();
if (i2c_status == TRUE)
{
while(bspI2cSelect(interface_0, slaveaddr_charger) == 0) //slaveaddr_charge= 0x6B , interface_0 = BSP_I2C_INTERFACE_0
{
Task_sleep(MS_2_TICK); // (((100) * 1000) / Clock_tickPeriod)
}
{
if (bspI2cWrite(REG04,2) == true)
{
UART_write(SbpUartHandle, "REG0A writen \n\r", 15);
/* Success */
}
}
}
bspI2cDeselect();
bspI2cClose();
}
in simple bleperipheral
// battery event after every 10 sec event occurs
if (events & BAT_TIMER_EVT)
{
events &= ~BAT_TIMER_EVT;
i2c_status = bspI2cOpen();
if (i2c_status == TRUE)
{
UART_write(SbpUartHandle, "i2c true \n\r", 11);
while(bspI2cSelect(interface_0, slaveaddr_charger) == true) //interface_0 = BSP_I2C_INTERFACE_0,slaveaddr_charger = 6B
{
Task_sleep(MS_2_TICK);
}
{
if (bspI2cWriteRead(®0000, 1, ®00, 1) == true)
{
/* Success */
UART_write(SbpUartHandle, "\n\r reg00 \n\r", 7);
UART_write(SbpUartHandle, ®00, 1);
}
}
bspI2cDeselect();
bspI2cClose();
}