1 year ago

#256680

test-img

Seppde

Qt + FTDI - how to best maintain the cross-platform capabilities when using Dual-HID (FT260H) or Dual-MPSSE (FT2232H) and relying on plug-and-play?

Im working on a project that implements a RS485 interface currently using a FT230 that has a single UART-Interface via VCP. This way, in Qt, I can use the SerialPort library without any issues, working both in Linux and Windows.

Now I want to add I2C capabilities to the system to read additional sensor data. I want to stick with the FTDI chips and keep programming to a bare minimum if possible. Then again, there might be better solutions to my problem and I am open to change my mind.

After searching the web for hours now and gathering a bit of information I've got a couple of questions. I'm relatively new to programming and I still find all the different USB-libraries for Windows and Linux confusing.

Questions:

  1. FT260 - this chip creates 2 HID-Devices. Which library could I use that would allow me to use those both on Linux and Windows? I looked at QtUsb (https://github.com/fpoussin/QtUsb) and was indeed able after a while of trying to compile and run the example codes of the github repository on both systems.

--> my Question concerning this chip: Can I use the hidapi library that is part of QtUsb (i.e., is hidapi enough) on Linux/Windows to simultaneously use the 2 HID-devices as a UART and I2C interface? Could I additionally use the FT260lib.h to make my life easier (It seems to be windows specific...)? Is there another way to interface with HID-devices using the same source code on Windows and Linux?

  1. FT2232 - as far as I understand, this chip can be configured to represent 1) a Virtual Com Port and 2) a generic Serial Interface at the same time. 1) is very good as this would mean I can keep the SerialPort part of my application with minor changes, if any.

--> With 2. though, I read of an issue on Linux: Linux only installs one driver per VID/PID combination. (Right?) As written here - https://electronics.stackexchange.com/questions/521714/ft232h-ft2232h-mount-as-dev-i2c-x - this causes the FT2232H to only appear as a VCP on Linux without a 2nd channel. Does this pose a problem or could I use e.g. the FTDI d2xx driver to interface the 2nd channel?

  1. The advantage with the FT2232H is that it saves me the trouble of rewriting any code for the RS485 interface. However it seems I would still need to use some specific library to interface with the I2C side of things. --> Can the d2xx library be used with the same code base for Windows/Linux? Can I use libMPSSE somehow in my scenario - datasheet says there is a linux/windows libMPSSE - or would this require separate code for Linux/Windows?

Man, sorry for such long writing. I hope my questions are somewhat clear though. Thanks in advance, I will try and reply quickly on comments and answers

qt

libusb

ftdi

0 Answers

Your Answer

Accepted video resources