FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Topics - BigApple

Pages: [1]
1
Discussion - Software / LibMPSSE I2C Library ACK Issue
« on: January 08, 2024, 08:18:38 PM »
I downloaded the DLL libraries, examples, and source code from the following link
https://ftdichip.com/software-examples/mpsse-projects/libmpsse-i2c-examples/

After running the code I noticed that the library is having an issue reading the ACK bit.

In the attached scope capture, the slave successfully acknowledges the 9th bit.  However, the FTDI device does not see it.

In LibMPSSE-I2C, I noticed there's a function called: static FT_STATUS I2C_Write8bitsAndGetAck(FT_HANDLE handle, uint8 data, bool *ack)

The function appears to call

Code: [Select]
status = FT_Channel_Write(I2C, handle, noOfBytes, buffer, &noOfBytesTransferred);
which writes a byte a data along with the 9th clock for the acknowledge bit.

For some reason, the code then calls this
Code: [Select]
{/*Get ack*/
noOfBytes = 1;
noOfBytesTransferred = 0;
INFRA_SLEEP(1);
status = FT_Channel_Read(I2C, handle, noOfBytes, inBuffer,
&noOfBytesTransferred);

I'm confused about the
Code: [Select]
/*Get Ack*/ code.  Exactly where does the I2C library read the ACK bit?

From what I can tell the library reads the acknowledge bit AFTER the 9th clock.  Is this correct?

Based on my understanding of I2C, this is the wrong time to read the acknowledge bit.




2
Discussion - Software / Linux D2XX won't open by locationID
« on: July 14, 2020, 04:48:51 PM »
For some reason D2XX won't open a FT4232H device on Linux.  I'm using function calls FT_CreateDeviceInfoList(), FT_GetDeviceInfoList(), and FT_OpenEx() in the driver.

Here is the code which is based on an example:
Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "../ftd2xx.h"

static void showVersion (DWORD locationID)
{
     FT_STATUS ftStatus;
     FT_HANDLE ftHandle = (FT_HANDLE) NULL;

     ftStatus = FT_OpenEx((PVOID)(uintptr_t)locationID, FT_OPEN_BY_LOCATION, &ftHandle);

     if (!FT_SUCCESS(ftStatus))
     {
          printf("FT_OpenEx failed (error %d)\n",
                 (int)ftStatus);

          return;
     }

     (void)FT_Close(ftHandle);
}

int main (void)
{
     FT_STATUS                 ftStatus;
     FT_DEVICE_LIST_INFO_NODE *devInfo = NULL;
     DWORD                     numDevs = 0;
     int                       retCode = 0;

     ftStatus = FT_CreateDeviceInfoList(&numDevs);

     if (!FT_SUCCESS(ftStatus))
     {
          printf("FT_CreateDeviceInfoList failed (error %d)\n",
                 (int)ftStatus);
          retCode = EXIT_FAILURE;
          goto exit;
     }

     if (numDevs == 0)
     {
          printf("No devices connected\n");
          retCode = EXIT_FAILURE+1;
          goto exit;
     }
     else
     {
          printf("Number of devices is %d\n", numDevs);
     }

     /* Allocate Storage */
     devInfo = calloc((size_t)numDevs, sizeof(FT_DEVICE_LIST_INFO_NODE));

     if (devInfo == NULL)
     {
          printf("Allocation failure.\n");
          retCode = EXIT_FAILURE+2;
          goto exit;
     }

     ftStatus = FT_GetDeviceInfoList(devInfo, &numDevs);

     if (!FT_SUCCESS(ftStatus))
     {
          printf("FT_GetDeviceInfoList failed (error %d)\n",
                 (int)ftStatus);
          retCode = EXIT_FAILURE+3;
          goto exit;
     }


     for (int i=0; i<(int)numDevs; i++)
     {
          printf("Device[%d] Type is 0x%x\n",  i, devInfo[i].Type);
          printf("Device[%d] LocId is 0x%x\n", i, devInfo[i].LocId);
          printf("Device[%d] Flags is 0x%x\n", i, devInfo[i].Flags);
          showVersion(devInfo[i].LocId);
     }


exit:
     free(devInfo);
     return retCode;

}

Here is the output (x4):
Number of devices is 4
Device[0] Type is 0x3
Device[0] LocId is 0x0
Device[0] Flags is 0x1
FT_OpenEx() fails with error 2 (FT_DEVICE_NOT_FOUND).

A device info flags value of 1 seems to indicate that the device is already open.  Is that correct?

The error code from open function seems to indicate that the device was not found, which is a little confusing.

I unloaded the VCP driver as explained in
https://www.ftdichip.com/Support/Documents/AppNotes/AN_220_FTDI_Drivers_Installation_Guide_for_Linux.pdf

Code: [Select]
linux@linux-desktop:~$ sudo rmmod ftdi_sio
linux@linux-desktop:~$ sudo rmmod usbserial
linux@linux-desktop:~$ dmesg | grep ftdi
[13124.959002] usbcore: registered new interface driver ftdi_sio
[13124.959155] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[13124.962715] ftdi_sio 1-1.2:1.1: FTDI USB Serial Device converter detected
[13124.963148] ftdi_sio 1-1.2:1.2: FTDI USB Serial Device converter detected
[13124.965881] ftdi_sio 1-1.2:1.3: FTDI USB Serial Device converter detected
[13171.085880] ftdi_sio ttyUSB3: FTDI USB Serial Device converter now disconnected from ttyUSB3
[13171.086023] ftdi_sio ttyUSB2: FTDI USB Serial Device converter now disconnected from ttyUSB2
[13171.086336] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
[13171.087592] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[13171.087638] usbcore: deregistering interface driver ftdi_sio
[13171.087688] ftdi_sio 1-1.2:1.3: device disconnected
[13171.087751] ftdi_sio 1-1.2:1.2: device disconnected
[13171.087810] ftdi_sio 1-1.2:1.1: device disconnected
[13171.087868] ftdi_sio 1-1.2:1.0: device disconnected

Anyone see why the device isn't opening? :-\

Pages: [1]