Problem with okUsbFrontPanel_ReadI2C

I’m using XEM3010 firmware ver. 3.0 under Windows XP, Visual Basic 6.

       Most everything (including okUsbFrontPanel_WriteI2C) is working OK, but when I attempt to read the I2C bus I get error okI2CUnknownStatus.  The I2C bus appears to crash (okUsbFrontPanel_WriteI2C no longer works), but communication with the FPGA continues unaffected.  I2C bus operation can only be restored by cycling the power.

       The VB6 declaration of Function okUsbFrontPanel_ReadI2C is as follows:

       Private Declare Function okUsbFrontPanel_ReadI2C Lib "okFrontPanel" (ByVal xem As Long, ByVal addr As Integer,  ByVal length As Integer, ByRef Data As Byte) As Long.

       The preceding declaration is basically identical to the declaration used for okUsbFrontPanel_WriteI2C, which works OK.  I'm reasonably sure the problem is not overflow of the buffer used to receive the data.

       Any assistance would be appreciated.

Harry S. Reichard

What are the specific parameters to your call?

Have you tried this under C or C++?

Dim lVar As Byte
Dim lErrCode As Long

lErrCode& = okUsbFrontPanel_ReadI2C(xem, &H27, 1, lVar)

I have not tried C#, or C++.

hsreichard

Hm. And what’s the write command you’re using? And what is the device you’re trying to talk to? (Manufacturer and Part Number)

Declaration: Private Declare Function okUsbFrontPanel_WriteI2C Lib “okFrontPanel” (ByVal xem As Long, ByVal addr As Integer, ByVal length As Integer, ByRef Data As Byte) As Long

Dim lErrCode As Long
Dim lData as Byte
lErrCode& = okUsbFrontPanel_WriteI2C(xem, &H26, 1, lData)

The I2C part is Texas Instruments PCF8574N. It works OK (both read and write) when I use a different I2C host.

I only briefly looked at the datasheet, but did not see that the device has two separate I2C addresses for read/write. Are you changing the A0-A2 lines between reads and writes?

For most I2C devices, you will use the same address for both reads and writes. The R/W bit (bit 0) of the first word after START is automatically taken care of by your choice between “read” and “write”.

Does your read succeed if you use address &H26 ?

Sorry, I should have made it clear. There are two separate PCF8574N; I write to one at 0x26, read from the second at 0x27. I really appreciate your help in this.

But, to answer your question: If I change the address of the read function to &H26, it still fails. The behavior is exactly the same as using &H27 as the read address. Also, the same hardware (two PCF8574N, using the same read, write addresses) works OK from a different I2C host (Quick USB).

Harry–

We have a fix coming for this. Please email support@opalkelly.com for more details.

Opal Kelly Support

Fix worked! Thank you very much. Harry.