FTDI Community

General Category => Test and Review Area => Topic started by: DRN on November 21, 2023, 12:30:59 AM

Title: FT232H LibMPSSE_1.0.3 library goes into infinite loop
Post by: DRN on November 21, 2023, 12:30:59 AM
I need to use FT232H to control an I2C bus, on Windows 10, in a C++ application.
I'm using the AdaFruit FT232H Breakout (Product ID: 2264) on a Windows 10 PC.
Using the latest FTDI DLL.

I've got a Qwiic sensor board connected to the breakout board's Qwiic connector.
The sensor board and cable work fine with a Microchip MCP2221 USB-I2C adapter so they're AOK.
But I can't access the I2C sensor using the FT232H - library goes into an infinite loop.

I understand I should use the FTDI MPSSE library.
On your forum I found you have released LibMPSSE 1.0.3 to your website:
https://ftdichip.com/software-examples/mpsse-projects/

I downloaded the following and incorporated it into my project:
https://ftdichip.com/wp-content/uploads/2022/07/LibMPSSE_1.0.3.zip

Unfortunately, inside I2C_InitChannel, FTDI's libMPSEE software goes into an infinite loop in FT_InitChannel.
The call stack is attached.

Any idea what is going on???
Is there an updated version of the library with bugfixes?
Thanks in advance for any help,
Best Regards, Dave


PS: Here's the program output:
Hello World!
ftd2xx.dll loaded OK!
Found at least one channel on FT232H
Information on channel number 0:
                Flags=0x2
                Type=0x8
                ID=0x4036014
                LocId=0x22
                SerialNumber=FTP6SN3W
                Description=FT232H
                ftHandle=0x0 (0 unless channel is open)

Version Check
libmpsse: 00010001
libftd2xx: 00030216

handle=0xc586c8 status=0

>>> Goes into infinite loop inside I2C_InitChannel...

PS: With an older version of the library, the channel initialized but I could not access
the I2C device (it always reported FT_DEVICE_NOT_FOUND).
Title: Re: FT232H LibMPSSE_1.0.3 library goes into infinite loop
Post by: FTDI Community on December 15, 2023, 11:13:14 AM
Hello,

We have a new libmpsse version that you can try (V1.0.4).

Please contact your local support team for this:

https://ftdichip.com/technical-support/

The alternative is not to use LibMPSSE library and use D2xx driver direct which will give you more control:

To use I2C/SPI as a master (no slave functionality), see AN_135 MPSSE Basics (https://ftdichip.com/wp-content/uploads/2020/08/AN_135_MPSSE_Basics.pdf) and our existing MPSSE Example projects:
 
https://ftdichip.com/software-examples/mpsse-projects/
 
There are two options to use I2C/SPI modes with the MPSSE engine:
 
a.   Use LibMPSSE libraries. Example code is provided with the download. Source code is also provided.
b.   Use D2XX drivers direct. Example code is shown at I2C (https://ftdichip.com/software-examples/mpsse-projects/#usb-to-i2c-inteface) / SPI (https://ftdichip.com/software-examples/mpsse-projects/#usb-to-spi-interface). AN_108 Command Processor For MPSSE and MCU Host Bus Emulation Modes (https://ftdichip.com/wp-content/uploads/2020/08/AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes.pdf) provides the necessary information.
 
Option b is the best option to use the D2XX drivers direct (no dependency on libMPSSE library).

Best Regards,
FTDI Community
Title: Re: FT232H LibMPSSE_1.0.3 library goes into infinite loop
Post by: DRN on December 15, 2023, 05:03:58 PM
Thanks, I have emailed US support.
It would be really great if you could put the updated library on the web site;
would spare all of us a lot of grief, thanks!
Title: Re: FT232H LibMPSSE_1.0.3 library goes into infinite loop
Post by: DRN on December 22, 2023, 01:59:04 PM
Details of how I fixed the infinite looping problem in LibMPSSE version 1.0.4 (not 1.0.3) (http://www.ftdicommunity.com/index.php?topic=900.msg2610#msg2610)