Datasheet

www.ti.com
Appendix G
8. ModCalBoard
(a) Initialization()
(i) If Cal Board in use then exit
(ii) Use modComm.I2CReadWrite() to turn on power
(iii) Use modComm.CheckForError to check for Bq80xRW1 errors
(iv) Turn off voltage and current if ON Turn off current
(v) Setup the temperature sensor resolution
(vi) Loop until no Bq80xRW1 errors
(b) InitialTurnOnPower()
(i) Set voltage setting time.
(ii) If current is enabled, set current setting time.
(iii) If DF writing not enabled then increase settling time.
(iv) Set LED state
(v) Initially turn on power
(vi) Delay for setting time
(vii) Check for errors
9. modCalibrateZ80
(a) CalibratePackVoltage()
(i) Enter calibration mode
(ii) Actual calibration code
(iii) Exit calibration mode
(iv) If 0 = CalibratePackVoltage then return error code
(b) DoCalibration()
(i) Write CalCtrlHi and CalCtrlLo to target
(ii) If no errors then delay and set doing_cal true
(iii) iCounter is incremented but never used
(iv) lError = Read CalStatusCmd over SMBus as 2 bytes
(v) yMS = yMS And (Not CalADCCExecuteHi)
(vi) doing_cal = yMS Or yLS)
(vii) delay 200 ms
(viii) Loop back to iii until doing_cal is false
(ix) Check error codesread SMBus CalErrorCmd
(x) If calibration error then InterpretCalError to compute DoCalibration
(xi) Return DoCalibration
(c) EnterCalibrationMode ()
(i) Using ReadSMBusWord read CalVerifyCmd
(ii) If already in calibration mode then exit
(iii) Using WriteSMBusWord write nTIMfgAccessCmd, with CalSubCmd
(iv) Using ReadSMBusWord read CalVerifyCmd
(v) If not in calibration mode then return VB_ERR_NOT_IN_CAL_MODE
(d) ExitCalibrationMode()
(i) Using ReadSMBusWord read CalVerifyCmd
(ii) If not in calibration mode then exit.
(iii) Using WriteSMBusCommand write CalExit to switch back to gas gauge code.
(e) CalMode_CalibrateCCBoardOffset()
(i) Note: Do CC Offset, should also Or VoltageGainLo as a workaround for h/w problem but on
z80 this causes an error, so commented
(ii) Set Voltage Time to 17000 ms
(iii) Set CC Offset Time to 17000 ms
(iv) Send signal levels to the target because we will turn on Voltage calibration for h/w bug
(v) Expected error 5024 so ignore it (only if voltagGainLo is set)
(vi) Errors will result in Cal not being written to DF, so explicitly write
10. modChecks
(a) PostCalibrationChecks()
(i) This function is called from the main loop. This is where we perform checks. Non-zero return
values indicate an error and will cause the test to fail.
47
SLUU397A February 2011 Revised May 2011 Programming Guide
Submit Documentation Feedback
Copyright © 2011, Texas Instruments Incorporated