Q1 Software Design Reference
Q1 Software Design Reference
Vince Toledo
ABSTRACT
This application note provides an outline for the basic communications between the BQ79606A-Q1 device
and a host system. This includes communications for a single BQ79606A-Q1 device or a stack of
BQ79606A-Q1 devices. Examples, such as auto-addressing and reverse-addressing, are included to
provide the user with simple demonstrations of the basic communications of the device. The information is
meant to provide an overview of the communications information outlined in the BQ79606A-Q1 SafeTI™
Precision Monitor With Integrated Hardware Protector for Automotive Battery Pack Applications data
sheet.
The communications used in this document are presented in a series of hexadecimal byte values. The
actual device communications are sent in standard UART (universal asynchronous receiver-transmitter)
format.
Contents
1 Reading and Writing Registers ............................................................................................ 2
2 Shutdown and Wakeup Sequence ........................................................................................ 4
3 Auto-Addressing ............................................................................................................. 4
4 Initializing Devices .......................................................................................................... 8
5 Read Cell Voltages ........................................................................................................ 10
6 Enable Cell Balancing .................................................................................................... 10
7 Reverse Device Addressing and Communications .................................................................... 11
List of Figures
List of Tables
1 Single Device Read Command Frame.................................................................................... 2
2 Single Device Write Command Frame .................................................................................... 2
3 Stack Read Command Frame ............................................................................................. 2
4 Stack Write Command Frame ............................................................................................. 2
5 Broadcast Read Command Frame ....................................................................................... 3
6 Broadcast Write Command Frame ....................................................................................... 3
Trademarks
All trademarks are the property of their respective owners.
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 1
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Reading and Writing Registers www.ti.com
2 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Reading and Writing Registers
1.2.1 ReadReg
The basic structure for the ReadReg function is as follows:
#_of_Read_Bytes = ReadReg(Device_Address, Register_Address, Incoming_Data_Byte_Array,
#_Data_Bytes, ms_Before_Time_Out, Packet_Type)
This line reads 12 bytes of data from register 0x0207 of the device nDev_ID and stores it in a local byte
array (on the microcontroller) called bFrame. The packet type is a single device read.
1.2.2 WriteReg
The basic structure for the WriteReg function is as follows:
#_of_Sent_Bytes = WriteReg(Device_Address, Register_Address, Data, #_Data_Bytes, Packet_Type)
Device_Address and #_Data_Bytes are integers, while Register_Address and Data are hex values (with
the prefix "0x"). For example:
nSent = WriteReg(nDev_ID, 0x0106, 0x01, 1, FRMWRT_SGL_NR);
This line writes to register 0x0106 of the device nDev_ID, with one byte of data. The data sent is 0x01.
The type of packet is a single device write.
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 3
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Shutdown and Wakeup Sequence www.ti.com
From shutdown, ensure there is tSU(WAKE) = 7 ms of delay per board before beginning communications.
The broadcast shutdown command is called as follows:
D0 01 05 08 6B B2
• D0 = Broadcast write of 1 byte
• 0105 = Write to register address 0x105
• 08 = Data byte to write
• 6BB2 = CRC
This can be done in the LaunchPad sample code by broadcasting the following:
WriteReg(0, CONTROL1, 0x08, 1 FRMWRT_ALL_NR);
3 Auto-Addressing
Preparing the BQ79606A-Q1 device (or device stack) for communication requires wakeup (see previous
section), auto-addressing (this section), and initialization of each device (next section).
This line must be immediately after the "#include" lines in the bq79606.h file. This variable are used
throughout the TMS570 sample code (in sys_main.c and bq79606.c).
4 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Auto-Addressing
Before beginning device communications, it is important to ensure proper baudrate is set for the host
microcontroller and every device in the stack. To do this, first set the host baudrate to 250 k. For the
TMS570, this is done by the following line (this baudrate change is handled by the CommReset()
function):
sciSetBaudrate(scilinREG, 250000); //set microcontroller baudrate to 250k
Next, apply a COMM_RESET pulse to the base BQ79606A-Q1 device. This is done by sending a 500 µs
low pulse to the 606-RX line. The base BQ79606A-Q1 device is now 250 k baudrate. All other devices are
still at their default baudrate (1M). For the TMS570, this RX pulse is sent with the following command (this
function handles all other requirements for changing the baudrate):
CommReset(); // send COMM_RESET pulse to base device
Now that the base device is guaranteed to be at the same rate as the microcontroller, you can now send a
command to all of the BQ79606A-Q1 devices to change all baudrates. This can be whatever baudrate is
desired. You can also enable all interfaces for the BQ79606A-Q1 during this write by writing two bytes
instead of one. The first byte sets the baudrate, the second byte enables all interfaces:
• 0x303C (baudrate = 125000)
• 0x343C (baudrate = 250000)
• 0x383C (baudrate = 500000)
• 0x3C3C (baudrate = 1000000)
The command frame to set the baudrate to 1M and enable all interfaces for all BQ79606A-Q1 devices is
as follows:
D1 00 20 3C 3C C8 C9 //set baud rate to 1000000, enable interfaces
Lastly, set the baudrate of the microcontroller to the desired baudrate to continue communications (Note:
If you do not set the baudrate of the microcontroller to the same baudrate that you just gave the
BQ79606A-Q1 devices, communications fails). For the TMS570, the baudrate can be set by the following
(handled within the CommReset() function):
sciSetBaudrate(scilinREG, 1000000); //set TMS570 baudrate to 1M
Next, make sure auto-address mode is set on all devices (and NOT GPIO address mode) by setting the
CONFIG register (0x001):
D0 00 01 00 39 74
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 5
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Auto-Addressing www.ti.com
Now, enable and enter auto-addressing mode on the devices by setting the CONTROL1 register (0x105):
D0 01 05 01 AB B4
• D0 = Broadcast write of one byte
• 0105 = Write to register address 0x105
• 01 = Data byte to write
• ABB4 = CRC
LaunchPad:
WriteReg(0, CONTROL1, 0x01, 1, FRMWRT_ALL_NR);
To individually distribute an address for each device, loop through the number of devices and give each
device an address. Broadcast write consecutive addresses until all parts have been assigned a valid
address.
Note: This is a rare instance in which a "Broadcast Write" command actually acts on each device
INDIVIDUALLY, despite being a broadcast.
D0 01 04 00 6B E4
D0 01 04 01 AA 24
D0 01 04 02 EA 25
....
• D0 = Broadcast write of one byte
• 0104 = Write to register address 0x0104 (DEVADD_USR register)
• 00, 01, 02... = Data byte to write (assigns each device address)
• XXXX (last 2 bytes) = CRC
LaunchPad:
for (nCurrentBoard = 0; nCurrentBoard <= TOTALBOARDS - 1; nCurrentBoard++)
{
WriteReg(nCurrentBoard, DEVADD_USR, nCurrentBoard, 1, FRMWRT_ALL_NR);
}
Now that each device has an address, the devices must be set to base, stack, and/or top of stack. There
are two possible setups:
2 OR MORE DEVICES IN STACK:
If there are multiple devices in the stack, there must be a base device and a top of stack device. The
easiest way to configure each device is to first set EVERY device as a stack device (0x02), then set the
top of stack and base devices individually:
1. Broadcast write CONFIG=0x02 to all devices
2. Single device write CONFIG=0x00 to device 0x00 (base device)
3. Single device write CONFIG=0x00 to device TOTALBOARDS-1 (top of stack)
Provided is a table representation of four devices in a stack:
6 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Auto-Addressing
For the top of the stack, set the TOP_STACK bit and the STACK_DEV bit in the CONFIG register:
90 0F 00 01 03 A6 98
• 90 = Single device write of one byte
• 0F = Device address (choose the address of the top device, in this case, the top device address is 15
[0x0F])
• 0001 = Write to register address 0x0001 (CONFIG register)
• 03 = Data byte to write (set as stack device AND top of stack)
• A698 = CRC
LaunchPad:
WriteReg(TOTALBOARDS-1, CONFIG, 0x03, 1, FRMWRT_SGL_NR);
1 DEVICE IN STACK:
If there is only one device, instead of the above commands, you can instead do one command to assign
the device as both the base AND top of stack (set CONFIG to 0x01):
90 00 00 01 01 24 4D
• 90 = Single device write of one byte
• 00 = Device address (there is only one device)
• 0001 = Write to register address 0x0001 (CONFIG register)
• 01 = Data byte to write (set as base device AND top of stack)
• 244D = CRC
Finally, an additional dummy read of ECC_TEST must be done to finish synchronizing the DLL:
C0 01 1D 00 64 B4
• C0 = Broadcast read of 1 byte
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 7
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Initializing Devices www.ti.com
4 Initializing Devices
There are several device configuration settings that are useful (but not required) for basic operation, and
must be set once the device has been auto-addressed.
8 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Initializing Devices
Now that the settings are chosen, OVUV functions can be enabled. OVUV_EN=1 must be set in the
CONTROL2 register:
D0 01 06 04 6B 47 // OVUV_EN=1
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 9
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Read Cell Voltages www.ti.com
Finally, the results can be read as before, and update continuously at the interval specified previously (5
ms for our example):
C0 02 15 0B D2 B3 // will return 6 overhead bytes and 12 data bytes per device
// highest device address responds first
[delay 1ms] //need to wait for the read bytes to complete sending
10 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Enable Cell Balancing
Next, reverse the direction of the base device's communications so that subsequent commands go to low
side:
90 00 01 05 80 B7 2D // set DIR_SEL in CONTROL1 register
Now that communications for the base device is in the proper direction, send broadcast write to all devices
to change their communications direction.
E0 01 05 80 64 D4 // broadcast to all devices to reverse direction
SLVA970E – March 2018 – Revised August 2019 BQ79606A-Q1 Software Design Reference 11
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
Reverse Device Addressing and Communications www.ti.com
Clear the CONFIG register of all devices so that STACK_DEV and TOP_STACK are cleared for all
devices:
D0 00 01 00 39 74 //clear CONFIG register
Now that the stack is fully reversed, auto-addressing can occur as normal. First, ensure that all devices
are prepared for auto-addressing by using a broadcast write to the CONTROL1 register. Set
ADD_WRITE_EN=1 and make sure that DIR_SEL=1 is still set in CONTROL1:
D0 01 05 81 AA 14 //prep auto-addressing with ADD_WRITE_EN=1 and make sure DIR_SEL is still 1
Assign each device a new address by broadcast writing to DEVADD_USR register, once for each device
in the stack, just as mentioned in the Auto-Addressing section of this guide:
D0 01 04 00 6B E4 // program device 0 (new base device)
D0 01 04 01 AA 24 // program device 1
D0 01 04 02 EA 25 // program device 2
...
Do not forget to correctly set stack devices. For a stack with three devices total (top of stack will be
different):
90 01 00 01 02 65B0 //set stack device with devID 1 as STACK_DEV
Do not forget to set the top of stack. For a stack with three devices total:
90 02 00 01 03 A4 34 //set device with devID 2 as TOP_STACK and STACK_DEV
12 BQ79606A-Q1 Software Design Reference SLVA970E – March 2018 – Revised August 2019
Submit Documentation Feedback
Copyright © 2018–2019, Texas Instruments Incorporated
www.ti.com Revision History
Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATASHEETS), DESIGN RESOURCES (INCLUDING REFERENCE
DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS”
AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD
PARTY INTELLECTUAL PROPERTY RIGHTS.
These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate
TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable
standards, and any other safety, security, or other requirements. These resources are subject to change without notice. TI grants you
permission to use these resources only for development of an application that uses the TI products described in the resource. Other
reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third
party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims,
damages, costs, losses, and liabilities arising out of your use of these resources.
TI’s products are provided subject to TI’s Terms of Sale (www.ti.com/legal/termsofsale.html) or other applicable terms available either on
ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable
warranties or warranty disclaimers for TI products.
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2019, Texas Instruments Incorporated