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.

BQ76930 CRC problem

Other Parts Discussed in Thread: BQ76940, MSP430G2553

Hello


I am using a BQ7693003DBTR. I am not able to write something so I suppose I have a CRC problem. With the logic analyzer I see this capture

I suggest the NACK is because the CRC does not work? Is that so or is my host hardware setup not correct?

I calculate the CRC with the code below. The CRC_KEY is 7 is that correct?


U8 CRC8(U8 *ptr, U8 len)
{
    U8 key = CRC_KEY;
    U8 i;
    U8 crc = 0;
    while(len-- != 0)
    {
        for(i = 0x80; i != 0; i /= 2)
        {
            if((crc & 0x80) != 0)
            {
                crc *= 2;
                crc ^= key;
            }
            else
                crc *= 2;
            if((*ptr & i) != 0)
                crc ^= key;
        }
        ptr++;
    }
    return(crc);
}

I hope somebody can give me some hints

  • The polynominal is shown on page 29 of the datasheet, in CRC calculation tools it is sometimes shown as 100000111.  For the sequence shown, 10, 04, 18 CRC would calculate to BE.  That is likely the reason for the NACK and that the write is not successful.

    For implementation, you might see the apnote "I2C Communication Sample Code for the bq76940 with a CRC Option Based on the MSP430G2553" http://www.ti.com/lit/pdf/slva626 and the CRC() function in the associated code http://www.ti.com/lit/zip/sluc583 for reference, it also used a key of 7.  Or perhaps other community members may be better able to suggest code changes.

  • Many thanks for the tip.
    I calculated the CRC with 0x08 as device address. I forgot to shift it. Now it works well.

    Many thanks for that.