The MAX17047/50 should be initialized prior to being used. The following registers should be written to these values in order for the MAX17047/50 to perform at its best. These values are written to RAM, so they must be written to the device any time that power is applied or restored to the device. Some registers are updated internally, so it is necessary to verify that the register was written correctly to prevent data collisions.
Please see the steps below to initialize the MAX17047/50:
Step 0. Check for POR
The POR bit is bit 1 of the Status Register.
Status = ReadRegister(0x00)
If POR=0, then go to Step 17.5.
If POR=1, then do Steps 1-17.
Step 1. Delay at least 500ms
After Power up, the MAX17047/50 requires 500ms in order to perform signal debouncing and
initial SOC reporting.
Step 2. Initialize Configuration
WriteRegister (0x1D , 0x2210) // Write CONFIG
WriteRegister (0x29 , 0x87A4) // Write FilterCFG
WriteRegister (0x2A , RelxCFG_Value) // Write RelaxCFG
WriteRegister (0x13 , 0x5F00) // Write FullSOCthr=95% to block full detection until at least 95%.
Set Iavg_empty(0x36) to C/4
For example, if a battery's design capacity (C) is 1000mAhr. Iavg_emptyshould be set to dec2hex(1000mA/4/0.15625mA) = 0x0640
WriteAndVerifyRegister (0x36,Iavg_empty)
Step 3. Choosing LearnCFG based on system shutdown method
For ModelGauge m3 devices, when Empty Learning is Enabled, QRTable is updated when battery voltage equals V_Empty. This means if the system is shutdown when VCELL > V_Empty, Empty Learning is not triggered. For drivers that shuts down the system when SOC > x % or when VCELL > V_Empty, this effectively disables empty learning when the fuel gauge has early error.
The custom model that is stored in the MAX17047/50 is also written to RAM and so it must be written to the device any time that power is applied or restored to the device. When the device is powered on, the host software must first unlock write access to the model, write the model, verify the model was written properly, and then lock access to the model. After the model is loaded correctly, simply write a few registers with customized parameters that will be provided by Maxim
Step 4. Unlock Model Access
To unlock access to the model the host software must write the following:
WriteRegister (0x62, 0x0059) //Unlock Model Access
WriteRegister (0x63, 0x00C4)
Step 5. Write/Read/Verify the Custom Model
Once the model is unlocked, the host software must write the 48 word model to the MAX17047/50. The model is located between memory locations 0x80h and 0xAFh.
//Actual bytes to transmit will be provided by Maxim after cell characterization.
//See INI file at the end of this document for an example of the data to be written.
Write16Registers (0x80)
Write16Registers (0x90)
Write16Registers (0xA0)
The model can be read directly back from the MAX17047/50. So simply read the 48 words of the model back from the device to verify if it was written correctly. If any of the values do not match, return to step 4.
Read16Registers (0x80)
Read16Registers (0x90)
Read16Registers (0xA0)
Step 6. Lock Model Access
To lock access to the model the host software must write the following:
WriteRegister (0x62, 0x0000) //Lock Model Access
WriteRegister (0x63, 0x0000)
Step 7. Verify that Model Access is locked
If the model remains unlocked, the MAX17047/50 will not be able to monitor the capacity of the battery. Therefore it is very critical that the Model Access is locked. To verify it is locked, simply read back the model as in Step 5. However, this time, all values should be read as 0x00h. If any values are non-zero, repeat Step 6 to make sure the Model Access is locked.
Step 8. Write Custom Parameters
Five additional registers should be written in this step with values that are provided by Maxim.
WriteAndVerifyRegister (0x38, RCOMP0) //Write and Verify RCOMP0
WriteAndVerifyRegister (0x39, TempCo) //Write and Verify TempCo
WriteRegister (0x1E, ICHGTerm) //Write ICHGTerm
WriteRegister (0x2C, TGAIN) //Write TGAIN
WriteRegister (0x2D, TOFF) //Write TOFF
WriteAndVerifyRegister(0x3A, V_Empty) //WriteAndVerify V_Empty
WriteAndVerifyRegister(0x12, QRTable00) //WriteAndVerify QRTable00
WriteAndVerifyRegister(0x22, QRTable10) //WriteAndVerify QRTable10
WriteAndVerifyRegister(0x32, QRTable20) //WriteAndVerify QRTable20
WriteAndVerifyRegister(0x42, QRTable30) //WriteAndVerify QRTable30
Step 9. Update Full Capacity Parameters
Capacity is a value provided by Maxim. If the INI does not have a VF_FullCap value, the Capacity should be used for both VF_FullCap and Capacity.
WriteAndVerifyRegister (0x10, Capacity) //Write and Verify FullCap
WriteRegister (0x18, VF_FullCap) //Write DesignCap
WriteAndVerifyRegister (0x23, VF_FullCap) //Write and Verify FullCapNom
Step 10. Delay at least 350ms
This delay must be at least 350ms to allow VFSOC to be calculated from the new configuration.
Step 11. Write VFSOC and QH values to VFSOC0 and QH0
VFSOC = ReadRegister(0xFF) //Read VFSOC
WriteRegister(0x60,0x0080) //Enable Write Access to VFSOC0 and Qh0
WriteAndVerifyRegister (0x48, VFSOC) //Write and Verify VFSOC0
Qh = ReadRegister(0x4D) //Read Qh register
WriteRegister(0x4C, QH) //Write Qh to Qh0
WriteRegister(0x60,0x0000) //Disable Write Access to VFSOC0 and Qh0
Step 11.5 Advance to Coulomb-Counter Mode
Advancing the cycles register to a higher values makes the fuelgauge behave more like a coulomb counter. MAX17047 supports quicker insertion error healing by supporting starting from a lower learn stage.
To Advance to Coulomb-Counter Mode, simply write the Cycles register to a value of 96%.
WriteAndVerifyRegister (0x17, 0x0060) // Write and Verify Cycles
Step 12. Load New Capacity Parameters
// VFSOC was read in step 11
RemCap = (VFSOC* VF_FullCap) / 25600
WriteAndVerifyRegister (0x0F, RemCap) //Write and Verify
RemCap
RepCap = RemCap * (Capacity/VF_FullCap)/ModelScaling
WriteAndVerifyRegister (0x05, RepCap) //Write and Verify
RepCap
//Write dQ_acc to 200% of Capacity and dP_acc to 200%
dQ_acc = (VF_FullCap/ 16)
WriteAndVerifyRegister (0x46, 0x0C80) //Write and Verify dP_acc
WriteAndVerifyRegister (0x45, dQ_acc) //Write and Verify dQ_acc
WriteAndVerifyRegister (0x10, Capacity) //Write and Verify FullCap
WriteRegister (0x18, VF_FullCap) //Write DesignCap
WriteAndVerifyRegister (0x23, VF_FullCap) // Write and Verify FullCapNom
//Update SOC register with new SOC
WriteRegister (0x06, VFSOC) //Write SOCRep
Step 13. Initialization Complete
Clear the POR bit to indicate that the custom model and parameters were successfully loaded.
Status = ReadRegister(0x00) //Read Status
WriteAndVerifyRegister (0x00, Status AND 0xFFFD) //Write and
Verify Status with POR bit Cleared
Step 14. Identify Battery