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.

BQ76952: REG12_CONTROL() subcommand

Part Number: BQ76952
Other Parts Discussed in Thread: BQSTUDIO

Hello,

I am working with the BQ76952 AFE and am trying to test out the subcommand to control the REG1 and REG2 outputs of the AFE during runtime (post configuration).
I have the REG0 enabled and I am able to configure REG1 & REG2 settings to 3.3v and have both outputs enabled as desired during regular operation.


Once out of configuration mode though, I cannot seem to get the runtime subcommand 0x0098 to properly control toggling REG2 off when commanded.


As a sanity check I attempted to use the TI Battery Management studio and was not able to find this command to test.  I am running on battery management studio version 1.3.101. 
Am I missing something here? 
Thanks!
  • Hello Garret,

    Did you also write the checksum and length to 0x60/0x61? This subcommand is one of the few that require this, the subcommands that require these are mentioned in Section 2 Subcommands of the BQ769x2 Software Development Guide.

    Some commands are not found in the BQSTUDIO list, as this command requires to send additional information with your desired configuration.

    As a side note, I'd recommend you use the test version 1.3.110.3 of BQSTUDIO, it offers some additional features and has all the latest firmware.

    Best Regards,

    Luis Hernandez Salomon

  • Yes, I write the checksum, but perhaps the calculation is incorrect?

    My current steps are as follows:

    1. Write two bytes starting at the lower command address location 0x3E
      1. In this case: 0x3E == 0x98, and 0x3F == 0x00
    2. Wait about 5ms for the transfer buffer to auto-fill
    3. Read one byte from transfer buffer starting at address 0x40 into local_transfer_buffer
    4. Read two bytes to get CRC and transfer length bytes starting at CRC address 0x60
    5. Copy my new command to the local_transfer_buffer
      1. In this case 0xCD is written to local_transfer_buffer[0]
      2. 0xCD should translate to Reg 1 and 2 == 3.3v, Reg 1 enabled, Reg 2 disabled
    6. Calculate the checksum for my new command
      1. uint8_t calculated_checksum = (command_id_local & 0x00FF) + ((command_id_local & 0xFF00) >> 8);
      2. calculated_checksum += buff_len; //buff_len in this case is just 1 byte for this particular command
      3. calculated_checksum = ~calculated_checksum; //Invert the checksum
      4. Write one data byte to AFE transfer buffer starting at address 0x40
      5. Write two bytes for the checksum and length bytes starting at the CRC address 0x60
        1. The length byte is set to 5 in this case: 2 for the command + 2 CRC and length bytes and + 1 more for actual payload

      Thanks for the recommendation on the other version of BQStudio. I updated to that and it auto-discovered the BQ76952 now instead of my manually having to select it, which is slick.

    7. Hi Garrett,

      I just tested the REG12_CONTROL() command with your settings and it works well. I think by "CRC" you mean checksum in your steps you described. The CRC is something different - it can be enabled on the I2C communication to check for errors. I'm not sure I fully understand your steps.

      I recommend the following steps for switching off and switching on REG2. You should not need to interact with the buffer 0x40 for these commands.

      Turn off:

      • Write 0x98 0x00 0xCD to 0x3E
      • Write 0x9a 0x05 to 0x60  (checksum and length)

      Turn on:

      • Write 0x98 0x00 0xDD to 0x3E
      • Write 0x8A 0x05 to 0x60 (checksum and length)

      Regards,

      Matt

    8. Ahh, perfect. Thank you for the reply.

      Sorry for the confusion on the CRC, yes I meant checksum.

      This line from the datasheet is what threw me off.  I thought it meant the literal number of bytes, 5 in this case, was added to the checksum.  I didn't understand it was the sum of command ID bytes plus the sum of all the data payload bytes.

      I have modified my the command writing function and it all works great now! 

      Thanks again!