From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Data Flash

Hi All,

 

I am currently trying to comminucate with TIs bq20z95 gas gauge chip over I2C. I've sucesssfully managed to establish communication and read data from the chip (voltage, current, FET statuses etc.) by write/reading the address of the data i want to the chip.

 

However I'm struggling with the next step: to write specific values to the chip (e.g. set the Overcharge limit) ie how to Data Flash the chip. 

 

The paragraph below is from the bq20z95's technical reference (p.100), however i am unsure (after trying quite a few permutations) about how to send data in this way to the chip:

 

To write the value of Term Voltage to a value of 8.7 V the following sequence is used.
Read complete Gas Gauging-IT Config subclass (SubclassID = 80) into RAM:
· Write Subclass ID
– SMB Slave Address (0x16)
– SMB CMD 0x77 with 0x0050 as data (=80 decimal)
· Read Subclass (2 blocks are needed as its over 32 bytes long)
– SMBSlave Address (0x16)
– SMB CMD 0x78 receiving 32 bytes of data
– SMB CMD 0x79 receiving 32 bytes of data
Overwrite offset 45 of received data with 8.7 V:
· Update offset 45 of second block with 0x21fc (=8700 decimal)
Write the complete subclass back to the bq20z90/bq20z95:
· Write Subclass ID
– SMB Slave Address (0x16)
– SMB CMD 0x77 with 0x0050 as data
· Write Subclass
– SMB Slave Address (0x17)
– SMB CMD 0x78 with 32 bytes of data
– SMB CMD 0x79 with 32 bytes of data 

 

Any help with this would be greatly appreciated.

 

Thanks, 

 

CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 1 of 6
(2,924 Views)

Hi CClear 87,

 

Thanks for your post. What are you using to communicate to the chip, software and APIs etc?

 

This may be something better asked of the chip manufacturer as the protocol will be defined by them and they may very well be able to help you out.

 

If you provide us with a little more information we may be able to help you out

 

Many thanks,

 

Liam

 

 

Liam A.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(2,866 Views)

Hi Liam,

 

Thanks for the reply.

 

I'm using NI's USB-8451 and its I2C VIs to communicate with the chip. At the moment i've managed to send data addresses to the chip (in hex format) and then read the data that is stored in those addresses using the Read/Write I2C VI.

 

However I don't know how to send actual data (as opposed to hex addresses) to the chip. This is where i need a bit of help. Would an array of hex values, sending the information mentioned in my first post be the way to go? or is there a simple way to do this i've missed.

 

Cheers,

 

Chris 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 3 of 6
(2,862 Views)

Hi Chris,

 

Thanks again for your reply. I think that the best thing to do at the moment would be to contact the manufacturer to see what they recommend as the best way of writing the information to the chip.

 

Once we know this then we can action it within LabVIEW using the I2C API that you are using now.

 

Sorry that we can't be of use at the moment but please let us know how you get on,

 

Many thanks,

 

Liam

Liam A.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 6
(2,842 Views)

Hi Liam,

 

TI's recommended way of writing data to the chip is included in my first post (an excerpt from their technical reference manual). I did contact them and they simply refered me to that page!

 

I am just confused how to do:

 

SMB CMD 0x77 with 0x0050 as data (=80 decimal)

 

I can write the command to the chip, but don't know how to send 0x0050 as data.

 

Thanks for the reply,

 

Chris 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 5 of 6
(2,839 Views)

Hi Chris,

 

Apologies for the slow response. I have had a quick browse and found the following links that may be of use regarding Implementing I2C in LabVIEW FPGA: 

 

http://zone.ni.com/devzone/cda/tut/p/id/3479

 

If you could let me know if this is appropriate or useful then that would be great.

 

Many thanks,

 

Liam

 

Liam A.
National Instruments
Applications Engineer
0 Kudos
Message 6 of 6
(2,809 Views)