![Texas Instruments bq27441-G1 Technical Reference Download Page 14](http://html1.mh-extra.com/html/texas-instruments/bq27441-g1/bq27441-g1_technical-reference_1095321014.webp)
Chapter 3
SLUUAC9A – December 2013 – Revised May 2015
Application Examples
3.1
Data Memory Parameter Update Example
This following example shows the command sequence needed to modify a Data Memory parameter. For
this example, the default
Design Capacity
is updated from 1000 mAh to 1200 mAh. All device writes (wr)
and reads (rd) are implied to the I
2
C 8-bit addresses 0xAA and 0xAB, respectively.
Step
Step Description
Pseudo Code
1
If the device has been previously SEALED, UNSEAL it by sending the
//Two-byte incremental Method
appropriate keys to
Control()
(0x00 and 0x01). Write the first 2 bytes of the
wr 0x00 0x00 0x80;
UNSEAL key using the
Control(0x8000)
command. Without writing any other
wr 0x00 0x00 0x80;
bytes to the device, write the second (identical) 2 bytes of the UNSEAL key
//Alternative single byte
using the
Control(0x8000)
command.
method
Note
: The remaining steps in this table use this single-packet method when
wr 0x00 0x00;
writing multiple bytes.
wr 0x01 0x80;
wr 0x00 0x00;
wr 0x01 0x80;
2
Send
SET_CFGUPDATE
subcommand,
Control(0x0013)
wr 0x00 0x13 0x00;
3
Confirm CFGUPDATE mode by polling
Flags()
register until bit 4 is set. May
rd 0x06 Flags_register;
take up to 1 second.
4
Write 0x00 using
BlockDataControl()
command (0x61) to enable block data
wr 0x61 0x00;
memory control.
5
Write 0x52 using the
DataBlockClass()
command (0x3E) to access the State
wr 0x3E 0x52;
subclass (82 decimal, 0x52 hex) containing the
Design Capacity
parameter.
6
Write the block offset location using
DataBlock()
command (0x3F).
wr 0x3F 0x00;
Note
: To access data located at offset 0 to 31, use offset = 0x00. To access
data located at offset 32 to 41, use offset = 0x01.
7
Read the 1-byte checksum using the
BlockDataChecksum()
command (0x60).
rd 0x60 OLD_Csum;
Expect 0xE8 for -G1B checksum.
8
Read both
Design Capacity
bytes starting at 0x4A (offset = 10). Block data
rd 0x4A OLD_DesCap_MSB;
starts at 0x40, so to read the data of a specific offset, use address 0x40 +
rd 0x4B OLD_DesCap_LSB;
mod(offset, 32). Expect 0x03 0xE8 for -G1B for a 1000-mAh default value.
Note
: LSB byte is coincidentally the same value as the checksum.
9
Write both
Design Capacity
bytes starting at 0x4A (offset = 10). For this
wr 0x4A 0x04;
example, the new value is 1200 mAh. (0x04B0 hex)
wr 0x4B 0xB0;
10
Compute the new block checksum. The checksum is (255 – x) where x is the
temp = mod(255 - OLD_Csum
8-bit summation of the
BlockData()
(0x40 to 0x5F) on a byte-by-byte basis. A
- OLD_DesCap_MSB
quick way to calculate the new checksum uses a data replacement method
- OLD_DesCap_LSB, 256);
with the old and new data summation bytes. Refer to the code for the indicated
NEW_Csum = 255 - mod(temp +
method.
+ 0x04 + 0xB0, 256);
11
Write new checksum. The data is actually transferred to the Data Memory
wr 0x60 New_Csum;
when the correct checksum for the whole block (0x40 to 0x5F) is written to
//Example: wr 0x60 0x1F
BlockDataChecksum()
(0x60). For this example New_Csum is 0x1F.
12
Exit CFGUPDATE mode by sending
SOFT_RESET
subcommand,
wr 0x00 0x42 0x00;
Control(0x0042)
13
Confirm CFGUPDATE has been exited by polling
Flags()
register until bit 4 is
rd 0x06 Flags_register;
cleared. May take up to 1 second.
14
If the device was previously SEALED, return to SEALED mode by sending the
wr 0x00 0x20 0x00;
Control(0x0020)
subcommand.
14
Application Examples
SLUUAC9A – December 2013 – Revised May 2015
Copyright © 2013–2015, Texas Instruments Incorporated