I’m just starting a project that involves talking to a board with an FT245R USB interface. I’ve got an XP VM set up with VS 2010 (some target machines will be running XP), the FTD2XX dll, the C# interface code published by FTDI, and some working VB6 code to get started with.
All seemed straightforward-ish. The first thing I had to do was rewrite the C# interface code to take out the message boxes it popped up when there were errors, and change it so that it throws exceptions instead of returning statuses that have to be checked for every call. It uses a somewhat bizarre and long winded way of referencing the functions in the dll, getting function pointers and marshalling them to delegates as they are used (rather than just using extern declarations), but it works so I left it.
Next thing was to create a Windows Forms app, and open the USB device using its description. Worked straight away. Excellent. Put some buttons on the form and run it again. Didn’t work – failed to open the device. That happened repeatedly, so I tried running the VB program. That worked, then running the app again worked. Then it didn’t. Continue reading “The VS IDE, the FTD2XX dll, the mouse, the keyboard, and a dent in a brick wall”