LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C 845X - Error Code -301742

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.

 

 

Download All
Message 1 of 14
(11,275 Views)
0 Kudos
Message 2 of 14
(11,262 Views)
0 Kudos
Message 3 of 14
(11,260 Views)

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).

Message 4 of 14
(11,247 Views)

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!

 

0 Kudos
Message 5 of 14
(11,242 Views)
You are correct in that I2C and SMBus are mostly compatible. You still need an address, though. Are you sure about the address of your device? I honestly have not read the datasheet in detail so I don't know how the address gets set. Also, it seems to me that you are using an example that was written for an EEPROM and trying to use it on this device. The device doesn't work like an EEPROM. Based on what I see you have to send a specific command for the parameter you want to read, and read only as many bytes as that parameter uses. The table in the datasheet indicates the commands for the parameters and the number of bytes.
Message 6 of 14
(11,230 Views)

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....

 

 

0 Kudos
Message 7 of 14
(11,226 Views)

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. 

Message 8 of 14
(11,195 Views)

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....

 

 

0 Kudos
Message 9 of 14
(11,191 Views)

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.

Message 10 of 14
(11,186 Views)