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.

BQ79616: bq79616 + bq79600 reverse direction command frames when BMS is running

Part Number: BQ79616

Hi !

      We have built a BMS system using bq79616 and bq79600, now we can set up the device address in both communication directions, but  then we can't change the communication direction.

Here is my code:

.WriteReg(0, CONTROL1, 0x0+0x80, 1, FRMWRT_SGL_W); //
WriteReg(0, COMM_CTRL, 0x00, 1, FRMWRT_SGL_W);
WriteReg(0, CONTROL1, 0x80, BoardNum-1, FRMWRT_REV_ALL_W);

/////// another code /////////////////////////

WriteReg(0, CONTROL1, 0x0+0x80, 1, FRMWRT_SGL_W); 
WriteReg(0, COMM_CTRL, 0x00, 1, FRMWRT_SGL_W);
WriteReg(0, CONTROL1, 0x80, BoardNum-1, FRMWRT_REV_ALL_W);

WriteReg(0, COMM_CTRL, 0x00, 1, FRMWRT_SGL_W);
WriteReg(BoardNum-1, COMM_CTRL, 0x03, 1, FRMWRT_SGL_W);

Best Regards,

  • Zhanglei,

    I do not know exactly how your code works, but if is based on the 616 sample code I think you are not clearing the top of stack correctly. 

    WriteReg(0, COMM_CTRL, 0x00, 1, FRMWRT_SGL_W);

    In the sample code, these parameters are (from right to left) device id, register id, data, number of registers to write, type of write. This clears the COMM_CTRL register in the base device, which is probably not necessary if you've already correctly auto-addressed.

    You need to clear the COMM_CTRL[TOP_STACK] from the top of stack device and then add the information to the new top of stack. You need to clear it before you switch the base device direction. You can still use single/broadcast writes without a top of stack. 

    WriteReg(BoardNum-1, COMM_CTRL, 0x03, 1, FRMWRT_SGL_W);

    This looks like the correct command to set a new top of stack, but if you do not clear the original top of stack the devices will not be able to communicate correctly past it.

    Regards,

    Ben