Specifically, Bridge Kit model Cypress Perform CY3240-I2USB Rev*A.
Cypress' own driver probably doesn't work beyond Windows XP, so any discussion of the Cypress-supplied driver is (becoming more and more) moot. I used another driver (Leitner's) in Windows 7. There is probably background here that isn't in my other entries on the subject, though, because this driver and narrative came first. (Perhaps one day I will better unify these pages.)
Leitner's solution was by far the best in Windows 7, but I should note my test with libusb. That worked in both Windows and Linux.
With the Cypress-supplied API / driver, I got everything working, but I had a number of serious issues. I couldn't find anything helpful on the web, so hopefully this will help. I first wrote this in 2011 (March).
My conclusion to the first few issues is that you're going to have to contact Cypress support to get anything done. (I have second-hand accounts that some of their key people are in a time zone far removed from the USA and are thus hard to get a hold of. However, I wound up not having to talk to those people, so hopefully this won't be a problem for you.)
Problem #1: As best I can tell, the most useful document I worked with was neither on the Cypress CD nor easily downloadable. I assume it came from support. (I was not involved in the very early phase of this project, so I'm missing some details.) The document is titled AN27079-DevPCApplicUSB-I2CBridge.pdf. See more detailed bibliographical info at the bottom. I refer to this as "the document."
Problem #2: The ActiveX control described in the document mentioned above does not come on the CD. Page 4 of the document refers to usb2iic.exe. There is a file of that name on the CD, but it does something else. I assume the actual .exe came from support. The proper EXE is described at the bottom.
Problem #3: It appears that the proper EXE had a hard time in Windows Vista. It worked fine in Windows XP SP3. As of 2012, I'm stronger in my belief that the EXE / API / driver doesn't work beyond XP.
Problem #4: The document is out of sync from the ActiveX API in terms of class names and such. Page 5 refers to "USB2IICcom_EXEClass Bridge;" and "Bridge = new USB2IICcom_EXEClass();" My working code reads "USB2IICcom_EXE1 Bridge;" and "Bridge = new USB2IICcom_EXE1();"
Step by step, here's how to reproduce what's on page 5 and correct it so it works. Page 5 is a C# sample. I'm using the SharpDevelop 4.0 open-source (GNU LGPL) IDE.
Note that if you try to compile the code given on page 5, without my subsitutions from Problem #4, you get an error like this:
The type or namespace name 'USB2IICcom_EXEClass' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\...path...\MainForm.Designer.cs:64,3
The complete MainForm.Designer.cs looks like the following. I had to add the "using" directives at the top, and I added the Bridge code at the bottom. Everything else is automated. (Note that the CDATA tags are not part of the C# code. They are needed to validate this XHTML page.)
When you run the above and click the button, the correct output is something like "Connected: 0000011". Note that MessageBox.Show() creates a pop-up, so it might get hidden behind something else.
Problem #5: To be consistent with my theme, the second most useful document is on the CD but isn't copied to the hard drive upon installation. It's the I2C-USB Bridge Quick Start.pdf. Bibliography at bottom. Note that this is not to be confused with the I2C-USB Bridge Guide.pdf, which is 8 pages, dated Sept 13, 2006, and is all about the EE rather than the software engineering. (As a programmer, it was useless to my immediate purposes.)
Problem #6: The "other" usb2iic.exe (or is it usbtoiic???). I mentioned above that the USB2IIC.exe with the ActiveX control wasn't on the disc. The USB2IIC.exe on the disc is a demonstration program to control chips with. It demonstrates the "Slave Demonstration Board" that comes with the Bridge Kit. To add to the confusion, there is a usbTOiic.exe floating out there with other Cypress software. (Are you confused yet? That's my point!)
The Quick Start guide shows you how to turn the lights on the demo board on and off through what you might call the demo program (the other USB2IIC.EXE), as shown on page 3 of the Quick Start guide.
"Personal" issue #7: I'm keeping the numbering system, but this goes into the category of things that might be obvious to some people or might be documented, but, because I struggled with it a bit, it's worth mentioning: In source code, the first parameter used with the demo program is the address that goes into the second paramter of the Bridge.SendIICdata function (in the case of the demo lights, the first 0x00. "s" simply means start, and "p" means stop. I'll get back to s and p in a moment). The rest of the parameters go into a byte array that is the last parameter to the function.
Here is code to turn the two demo lights on and off. I'm only showing the form file. Everything else is standard C# and similar to process to create the connection code above. Again, the CDATA stuff is only for purposes of displaying on this page. It's not C# code.
definitely-personal issue #8: This should be obvious, but just be aware that the MessageBox.Show() will show you decimal numbers (such as addresses) by default, and the Cypress demo program uses hexadecimal.
Personal issue #9: The address that the Cypress demo program uses is not necessarily what the code uses. I had a situation where the demo program used 0x40 and the code used 0x20. This might have something to do with 7-bit versus 8-bit addressing. You may have to use the GetDeviceList function mentioned on page 23 of the Application guide--it lists the addresses. Once you know the address, it doesn't seem to change. I think it's hardcoded (or firm-coded) into the chips.
Personal issue #10: If you come across a chip that works like this in the demo program:
s 40 0D 01 s 40 08 01 s 40 0B 00 p;
you have to call SendIICdata() three times, one for each "s".
Problem #11: Even when everything was working exactly right, I was still getting what were technically
error messages, but I'd call them warning messages. I'd get two types of messages, especially with the very
first SendIICdata() call. The errors were
ActiveX component is now Busy (Transaction is on)
Bridge is busy by other Application
Again, everything would work. One implication of this is that you'll probably have to direct errors to a log
rather than being popups.
I could get rid of these errors by adding some delays--on the order of dozens of ms, although I may have gotten away with far shorter periods. These errors are very puzzling, though, because all of this is supposed to be synchronous or blocking. My theory is that the Bridge may not have any way of knowing, in some cases, when the devices downstream are done.
Personal issue #12: Once the ActiveX control was registered, the EXE has to stay in the folder where you registered it. It has to be there even though a mini version of the EXE / DLL is produced with the main EXE. (This is largely beyond Cypress' control.)
Problem #13 (perhaps beyond Cypress' control): the ActiveX EXE was "stripped," which made it nearly impossible to change the DLL (It's an EXE that contains what is essentially a DLL) into a static library that could be combined with the EXE. I used a bunch of open source tools trying to do this, but I got nowhere. Cypress almost certainly had the option not to strip it. For that matter, all of the code should be open source.
Filename: AN27079-DevPCApplicUSB-I2CBridge.pdf
Quoting:
Developing PC Applications for USB-I2C Bridge
November 12, 2010 Document No. 001-27079 Rev. *B - 1 - AN27079
Author: Andrew Smetana
Associated Project: Yes
Associated Part Family: CY8C24894
Software Version: C#, Visual Basic, Delphi, C++
Associated Application Notes: AN2352
33 pages
Application Note Abstract
This application note describes how to use a USB-I2C bridge ActiveX control (bridge driver) in software designs. It discusses the history of ActiveX, ActiveX interface documentation, and its use in popular programming environments (languages).
Dated: November 12, 2010. 539kb in Windows Explorer, 551,679 bytes exactly. md5 = 501378550d6fbba1dc9321e3ee8afe00
The exe that registered the ActiveX control is 602kb in Win Explorer, 616,448 bytes exactly, md5 = 446e3b40bc30780f4c57175d8a9f64bf.
Filename: I2C-USB Bridge Quick Start.pdf
Title: I2C-USB Bridge Quick Start
dated internally September 25, 2006. This was written before "Revision A"
588kb in Windows Explorer detail view. 601, 259 bytes exactly.
md5 = 06f81d6367bc8df2869df8fb996f4538
Associated Part Family: CY8C4894
Software Version: PSoC Designerâ„¢ v. 4.3
Associated Application Notes: AN2352
5 pages
These don't have anything to do with Cypress. This was my first experience with C#, though, so I want to note these issues somewhere.
Personal issue #14: When a C# compiler spits out an EXE, it also spits out DLLs that need to be with that EXE. Good luck trying to combine these into a single, standalone EXE. I tried that for several hours and got nowhere.
Personal issue #15: I learned two surprising things about C#. The first is that the garbage collector doesn't
seem to be as smart as PHP's collector. I was running these two lines of code as I ran through a slide show:
Bitmap MyBitmap = new Bitmap("file path and name.jpg");
theForm.BackgroundImage = MyBitmap;
That rather quickly consumed memory and crashed the program. (It was more subtle than a crash, but had the
effect of a crash.) I've gotten very lazy and generally don't free memory in PHP. I've gotten away with it for
six years. The moral of the story is to watch your program's memory consumption and otherwise watch the program
a little longer what you would normally need for testing.
Personal issue #16: When you uncheck a checkbox within the program, such as "checkbox.Checked = false;", this will execute your click handling function. JavaScript does not do this, so I was shocked to discover this the hard way. You can write code to disable this, of course.