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.

Programming the BQ2060 directly in VB

Other Parts Discussed in Thread: BQ2060

I'm working on developing an automated test program for a battery pack that uses the BQ2060 as a fuel gauge.  The test specification from the customer requires reading and writing to the EEPROM.  I know it's possible to access the EEPROM through the SMBUS, because the EV2200-60 software package does just that. 

 

What I'm looking for is the SMBus commands that read and write to the EEPROM.  I expect there's a command that, when followed by a hex word, will read from or write to the address specified by the hex word.  Something like this:

 writesmbusword(byval ySubcommand as Byte, yMSdata as byte, yLSdata as byte)

where ySubcommand is the SMBus command and MSdata and LSdata are the most significant and least significant bits that in this case would spell out the address of the data in the EEPROM I'm looking for.  The function would return whatever's located at the address.  I've had no luck in locating what the value of Subcommand should be in any of the datasheets or application notes I've read.

Does anyone have any code for writing to or reading from the EEPROM? 

  • A little bit more background:

     

    I have an EV2300 module that I'm trying to use to talk to the BQ2060.   Since SMBus is SMBus, I would assume that reading the EEProm connected to the BQ2060 would be straightforward.  I'm programming this in VB6.

     

    I know that TI has code libraries for the EV2300 module, because I have a copy of them.  Is there any VB source code for the BQ2060?  If I have to buy an EV2200 I will, but I'd like to avoid it.

  • Hello Deckerg,

    Please check the bq2060 data sheet under ManufacturerAccess commands.  If you write data of 0x0606 to address 0x00, the gauge will internally multiplex the SMBus lines directly onto the I2C lines of the EEPROM within 900ms (assuming the bq2060 was not sealed).  You can now directly address the EEPROM.  That means you should use the device address of the EEPROM (0xA0) instead of the bq2060 device address (0x16).  When you are through communicating with the EEPROM, send any command with device address 0x16 and the mux will switch back from the EEPROM to the bq2060.

    Bill

  • Bill,

    Thanks for that.  Now my only issue is how to get the commands into the BQ2060.

    I have an EV2300 module that I'm trying to make work with the 2060.  It seems to me the commands should be there, but I can't explore the VB6 library that I have too deeply because the DLLs are proprietary.

    Basically, I know what I need to do I just don't know how to make the 2300 module do it.  Once I put the device into EEPROM mode, I need to do a basic SMBUS read word and a basic SMBUS write word.

    For reading, that's eight bits for the eeprom addressing, followed by an acknowledge, then the 8-bit address of the word I want to read, and another acknowledge, then send the eeprom addressing bits again with the read bit enabled, then read back the word.

    The code library I have for the 2300 doesn't have any SMBus commands that let me do that.  The closest one is:

     ReadSMBusWord(subcommand as byte, MSB as byte, LSB as byte, optional yAdrs as byte = H16 )

    MSB and LSB are the most significant byte and least significant byte of the word being read back, yAdrs will have to be set to HA0 to maintain eeprom communication.  That leaves only subcommand, which is only 8 bits and not enough to send the command for both telling the eeprom to read and telling where in the eeprom to read from.

    Is there a way to tell the EV2300 to do a standard SMBus read protocol?

  • Hello Bill,

    Could you tell me what does it exactly mean "bq2060 is not sealed"?

    Thanks a lot,

    Stevan

  • Hi Deckerg,

     

    Can you send me a copy of code libraries for the EV2300 module?

     

    Thank you in advance.

  • The code I'm using is attached.
    TI_Code.zip
  • Thank you Deckerg,

    Have a nice day.

    Boris.

  • Deckerg,

    I'm not sure if you have the right library file. Attached is the EV2300 customer kit. The zip file contains help file, example code, and more.

    That should get you start on your program.

     

     

    EV2300 Customer Kit.zip