10-20-2009 06:16 PM
Hello all,
I need help with my new USB-8451 I2C DAQ. I'm currently trying to use the I2C DAQ to interface with a TI device (BQ20Z80). I've looked into the NI Example files and found an example "General I2C Read.VI" which should allow me to write the address for the read operation and read the finding. However, when I run the VI I get the follow error message:
"Error -301742 occurred at NI-845x I2C Write Read.vi:1"
"Possible reason(s):
NI-845x: The slave did not acknowledge an address+direction byte transmitted by the I2C master. Reasons include the incorrect address set in the I2C configuration or the incorrect use of the 7-bit address. When entering an address to access a 7-bit device, do not include the direction bit. The NI-845x Basic I2C API internally sets the direction bit to the correct value, depending on the function (write or read). If your datasheet specfies the 7-bit device address as a byte, discard the direction bit (bit 0) and right-shift the byte value by one to create the 7-bit address."
I'm currently using the internal +5V signal on the USB-8451 to supply +5V to boththe clock and data line for my I2C signals. Both of my pull-up resistors are 4.3kohm. I scoped out my signals and both clock and data are sitting @ 4.3VDC.
In the front panel of the example vi, I've "address" = (50), "Clock Rate" = (100kHz), "Number of Byts to Read" = (128), "EEPROM Starting Address" = 0, "Number of Address Bytes" = 2, "Address Endinanness" = (Big Endian).
I've tried different combination of things but nothing seems to resolve this error message. It seems like the master has not sent anything to the slave and the device just errors out. I've read somewhere in the form that the default "Address" should be 50 unless there are multiple slaves. For the "EEPROM Starting Address" I've (08) which is the address I wish to look into for my TI (BQ20Z80).
I'll atttach some references here, please advise, I'm totally stuck.
10-21-2009 04:32 AM
10-21-2009 04:35 AM
10-21-2009 09:36 AM
I don't really see how either of those links helps in this situation, as this is a totally different situation...
Regarding the question: I think the fundamental problem here is that the device you have is an SMBus device, not an I2C device. The datasheet is quite explicit on this. As far as I can tell, the device has no address lines, so you can't use a fixed address. From a software perspective if you use the I2C functions you'd basically have to calculate the equivalent I2C address based on the command that you're trying to send. It may just be easier to do bit-banging.
This assumes, of course, that you don't have a hardware interface issue (such as pullups).
10-21-2009 11:03 AM
Hello Smercurio,
Yes, the pullup resistors are there, both the clock and the data line for my I2C device are both tied to high ~4.2VDC.
I think I know what your saying about my TI (bq20z80) device not having a fixed address to read from, but could you please elaborate more on your explaination. I'm very new to I2C communication. All I want to do is type in the corresponding (SBS Command) listed on my TI(bq20z80) chip and read the returned information.
You also mentioned in ur reply that the device im interfacing is SMBUS, but I'm using a I2C device to interface it, my understanding is that I2C can interface SMBUS device.
Please help!
10-21-2009 04:14 PM
10-21-2009 05:14 PM
That is correct. The TI (BQ20Z80) is a gas guage, it is intended to read parameters of a battery. The (SBS Commands) are the corresponding (hex address) for each individual parameters. I've looked at the spec sheet over and over, and I can't find a fixed address that calls out to read from. So is it safe to assume the (SBS Command ~ the hex address) is the address I should be reading from? I'm very new @ I2C programming in LabVIEW, I've tried to use MAX and write hex code (0x08) = Temperature reading for (TI BQ20Z80), and when I go to read it gives me a time out error. Please advise how I can write a string of command (hex address) and read it using I2C interface. I've done Serial communication applications using LabVIEW using hex commands and reading the returned signals, but this is definitely something different. It is a lot harder than I expected....
10-22-2009 10:38 AM
strider0202 wrote:So is it safe to assume the (SBS Command ~ the hex address) is the address I should be reading from?
No, that would not be correct. The address of the device is not the same as the address of the register you want to read. The I2C spec is published by Philips and can be found here. The SMBus spec is published by SMBus.org. The basic write transaction for a device with a 7-bit address consists of one byte that has the device 7-bit address with the last bit set to 0 to indicate a write. This is followed by an ACK from the device. The next byte usually consists of a command code. This would be the command code in that big table in the datasheet. This is followed by another ACK from the device. If the command code requires data then this would follow next in 8-bit chunks. A read transaction would be similar except the first byte would have bit 0 set to 1 to indicate a read transaction. The subsequent 8-clock chunks would be the data coming back from the device.
My suggestion would be to contact the manufacturer of the device and ask them about the address of the device.
10-22-2009 11:34 AM
Hi,
I've looked into the datasheet: http://focus.ti.com/lit/er/sluu276/sluu276.pdf
for my Ti Device and there is a section I believed to be the fixed address of this slave device, please advise.
2.9.3 bq20z80 Slave Address
The bq20z80 uses the address 0x16 on SMB for communication
This seems to be a lot more complicated then I expected. I'll have to read more information, so if i was to work with this type of data transfer in LabVIEW, do you think I have to work with binary numbers or does the 8451 I2C vi takes care of that....
10-22-2009 12:05 PM
That's not the same datasheet that you had provided before. Are you sure it's the right one?
If that's the right address, try the attached examples to see if they work. One of them reads the manufacturer access bytes. The other sets them. NOTE: I do not know if the values for the manufacturer access are correct for your device.