Other Parts Discussed in Thread: BQ34Z950, BQ34Z50
Dear All,
I am using SMBus communication to communicate with BQ34z950 via tm4c123gh6pm I2C. I am using utils smbus.c and smbus.h as driver library. I am having problem in SMBusMasterBlockWrite. When ever I am trying to write a register with SMBusMasterBlockWrite register value does not update. I am writing with SMBusMasterByteWordWrite it works fine.
Here is what I am doing.
The Working Function:-
buff[0] = (uint8_t) data; // Low byte
buff[1] = (uint8_t) (data >> 8); // Highbyte
ret = SMBusMasterByteWordWrite(&g_sMaster,SLAVE_ADDR,reg, buff, 2);
UARTprintf("\n\rret = %d ",ret);
while(SMBusStatusGet(&g_sMaster) == SMBUS_TRANSFER_IN_PROGRESS)
{
// Wait for transfer to complete
}
SysCtlDelay(2000);
Result:- Returns 0 and writes the data so when I read the register again with SMBusMasterByteWordRead it returns the updated value.
Not Working Function:
buff[0] = (uint8_t) data; // Low byte
buff[1] = (uint8_t) (data >> 8); // Highbyte
ret = SMBusMasterBlockWrite(&g_sMaster,SLAVE_ADDR,reg, buff, 2);
UARTprintf("\n\rret = %d ",ret);
while(SMBusStatusGet(&g_sMaster) == SMBUS_TRANSFER_IN_PROGRESS)
{
// Wait for transfer to complete
}
SysCtlDelay(2000);
Result:- ret = 0 but does not update the value in the register. So when I read it next time does not shows the updated value.
Please guide me If I am doing anything wrong or need to add anything for block write. Please Help!!
Regards,
Aman.