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.

BQ76942: I²C Commands for Writing MANU_DATA and Data Memory

Part Number: BQ76942
Other Parts Discussed in Thread: BQSTUDIO

Hi,

im writing Software to communicate with a BQ7694202 configured for 4-S Li-Ion. So far I successfully implemented several direct Commands, Command-Only-Subcommands and Subcommands with Data while reading. However when trying to write some arbitrary Numbers to the MANU_Data Memory the data read back is 0x00.

These are the I²C commands i use to write the number "0x73" to the MANU_Data Memory:

W08 0x3E 0x70 0xDA 0x00 0x00 (Subcommand 0x0070 for MANU_Data)

W08 0x40 0x90 (Set the internal pointer to the TransferBuffer Register 0x40)

W08 0x73 0x09 (Transmit the Data)

W08 0x60 0x70 (Set the internal pointer to the Checksum Register 0x60)

W08 0x2C 0x93 (Transmit the Checksum 0x2C)

W08 0x61 0x77 (Set the internal pointer to the Length Register 0x61)

W08 0x05 0x4C (Transmit the total Length of 0x05)

When reading the data back these are the I²C commands i use:

W08 0x3E 0x70 0xDA 0x00 0x00 (Subcommand 0x0070 for MANU_Data)

W08 0x61 0x77 (Set the internal pointer to the Length Register 0x61)

R08 0x24 (Answer is 24 Hex so 36 DEC (32 Bytes MANU Data + "Overhead"))

W08 0x40 0x90 (Set the internal pointer to the TransferBuffer Register 0x40)

R08 0x00 0x42 (Read the Data i expect the previously written 0x73 instead of the 0x00)

W08 0x60 0x70 (Set the internal pointer to the Checksum Register 0x60)

R08 0x8F (Read the Checksum)

After implementing the MANU_Data write, the next step would be to write to the Data Memory (CUV/COV Threshold Override etc). So far i can only read the various default values.

I checked the I²C Bus and the commands as listed above do get send perfectly fine on the bus. 

What am i missing or doing wrong?

Best Regards

Henning

  • Hello Henning,

    I'd recommend to read the following E2E thread:

    https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/904942/bq76952-setting-serial-number-manufacture-date-etc

    It has a command sequence example you could use.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    thank you for the link. I have problems applying the solution for my BMS since the BQ7694202 uses CRC. I couldn't find good info on how the CRCs are inserted into the normal commands. Per Trial and Error i concluded that the correct command to write the byte 0x73 to Manu_Data is:

    W08 3E 90 74 00 00 (SET_CFGUPDATE)

    W08 3E 70 DA 00 00 73 5E (Manu_Data with 0x73 as payload and CRCs 0xDA, 0x00, 5E)

    W08 60 70 (Set the internal pointer to the Checksum Register 0x60)

    W08 2C 93 (Transmit the Checksum 0x2C)

    W08 61 77 (Set the internal pointer to the Length Register 0x61)

    W08 05 4C (Transmit the total Length of 0x05)

    W08 3E 92 7A 00 00 (EXIT_CFGUPDATE)

    Reading back the data:

    W08 70 DA 00 00 (Manu_Data with no payload)

    W08 40 90 (Set the internal pointer to the TransferBuffer Register 0x40)

    R08 FF B1 (Read the Data i expect the previously written 0x73 instead of the 0xFF)

    All commands send from the I²C Master get ACKed by the BMS so i assume every CRC is correctly calculated and inserted in the communication. However i cant "retrieve" the data 0x73 from the BMS. What am I doing wrong?

    Best Regards

    Henning

  • Hello Henning,

    Let me look over the sequence and also see if I can replicate things from my side. I will update you by the end of the day tomorrow.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Henning,

    The CRC looks okay to me and overall sequence looks okay. Just in case, for examples with CRC, I'd recommend to read the BQ769x2 Software Development Guide.

    Are the checksum and length calculated correctly? This may be where things are not working, as it occurred in the previous E2E post, I unfortunately did not have time to test this on my side.

    If possible I'd recommend you to test the example that was shared in the previous E2E post (Shared above), by converting it to CRC. 

    Best Regards,

    Luis Hernandez Salomon

  • I think i made a mistake in calculating the checksum the ones complement of 0x70 0x00 and 0x73 should be 1C and not 2C

    I now tried the following sequence:

    W08 3E 90 74 00 00 (SET_CFGUPDATE)

    W08 3E 70 DA 00 00 73 5E (Manu_Data with 0x73 as payload and CRCs 0xDA, 0x00, 5E)

    W08 60 70 (Set the internal pointer to the Checksum Register 0x60)

    W08 1C 03 (Transmit the Checksum 0x1C)

    W08 61 77 (Set the internal pointer to the Length Register 0x61)

    W08 05 4C (Transmit the total Length of 0x05)

    W08 3E 92 7A 00 00 (EXIT_CFGUPDATE)

    Reading back the data:

    W08 70 DA 00 00 (Manu_Data with no payload)

    W08 40 90 (Set the internal pointer to the TransferBuffer Register 0x40)

    R08 FF B1 (Read the Data i expect the previously written 0x73 instead of the 0xFF)

    Unfortunately i still get the same result as before. 0xFF instead of my 0x73.

    Length should be correct. "Length includes the two bytes in 0x3E and 0x3F, the two bytes in 0x60 and 0x61 and the length of the transfer buffer." So a single byte "0x73" should have a length of 0x05

    I already read the Software Development Guide. I would like to adapt the code from the other E2E post, but the Information on CRC in longer commands is very sparse. I therefore tried to keep all commands as short as possible. Do i need to insert a CRC after every byte of data? Something like this: (CRCs are written in bold and underlined)

    ; Write 21 bytes of data
    W: 10 3E 70 DA 00 00 
    00 00 11 77 22 EE 33 99 44 DB 55 AC 66 35 77 42 88 B1 99 C6 11 77 22 EE 33 99 44 DB 55 AC 66 35 77 42 88 B1 99 C6 11 77 22 EE 33 99
    ; Write checksum
    W: 10 60 2F 9A 18 48

    (here the length is only 0x18 = 0d24; 21 bytes of data, 0x70 and 0x00 as commands and a single 0x60 since the length buffer is not written to individually but rather subsequently after the checksum.

    Is this sequence of inserted CRCs correct?

    Is there any further reading material regarding CRCs, especially regarding longer commands? I would also accept a complete list of commands to send to the BMS. ;) 

    Best Regards

    Henning

  • Hello Henning,

    Yes, you would need to write CRC for every byte of data. Just from the initial look of the CRC values, it seems correct to me! This is why I think the length or checksum may be incorrect... Since it seems to me that the CRC is fine.

    I wish we had an example to show for these longer sequences! Unfortunately we do not have one for an example like this one Disappointed

    This one is definitely a gnarly one to get right. I had not had time to check on this one on bench. But I am hoping tomorrow I can get in the lab and see if I can also try getting it working.

    Apologies for the complication here!

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    have you got any updates on this matter? I am still struggling with it.

    Best Regards

    Henning

  • Hello Henning,

    I really want to apologize for the long wait here.

    I was testing things out on my board and found something interesting. I ran the example I shared earlier (From the other E2E) and it actually worked just fine on my I2C CRC-enabled device. Even though I did not change the code at all. 

    You can try running it from your side on bqStudio and you'll probably see that it works.

    If you try to write MANU_DATA as if you did not have any CRC, are you able to write to it?

    Best Regards,

    Luis Hernandez Salomon