Other Parts Discussed in Thread: BQ76952
Hi
I have found your sample code: bq769x0_I2C_sample_code_with CRC in the file sluc583.zip
My question is: Why is the I2C slave address multiplied with 2 before the CRC byte is calculated? e.g:
int I2CWriteRegisterByteWithCRC(unsigned char I2CSlaveAddress, unsigned char Register, unsigned char Data)
{
unsigned char DataBuffer[4];
unsigned int SentByte = 0;
DataBuffer[0] = I2CSlaveAddress << 1; ???????
DataBuffer[1] = Register;
DataBuffer[2] = Data;
DataBuffer[3] = CRC8(DataBuffer, 3, CRC_KEY);
return(I2CSendBytes(I2CSlaveAddress, DataBuffer + 1, 3, &SentByte));
}
I2CSendBytes uses the I2CSlaveAddress, but the calculated CRC byte is not calculated with this address (0x08, but 0x10) the command should then be rejected !
Best Regards
Lars Jensen
LINAK A/S