FTDI Community
General Category => Discussion - Software => Topic started by: dania on December 20, 2021, 11:36:23 AM
-
Hello,
i have connected two devices to PC:
1. SIGMA 2 by ASIX (www.asix.cz), is "black box" for me
2. FT4232H with virtual COMs disabled, DE signal is enabled at Channel C and device name is changed to "Mila 5000". VID and PID are default. Channel A is used as I2C, Channel B is used as SPI and Channel C is used as RS485.
Operating System is Windows 10, Visual Studio 2022, FTD2XX_NET and LibMPSSE are used. Software is developed in C#.
Issue: Channel B have invalid handle (handle value is 0) after SPI_OpenChannel call. Return value of SPI_OpenChannel is FT_OK.
Note: If FT4232H is connected only (OMEGA 2 is disconnected), handle have correct value. When I connect OMEGA 2 only after openning FT4232H, bozh devices work properly.
-
I still tried to open Channel B in the same way as Channel C via FTD2XX API, without LinMPSSE use. Channel B not opened.
-
hello,
Could you clarify if you are using the SIGMA 2 or the OMEGA 2, as you say both in the post. The SIGMA 2 is a full speed device, whilst the OMEGA 2 is a Hi speed device. the FT4232H is also a Hi speed device.
Is the only time the issue occurs when the SIGMA/OMEGA is connected before FT4232H is opened? And when it is just the FT4232H connected or it is opened before the other device is connected, everything works fine?
Here is some helpful documentation:
http://www.ftdichip.com/Support/Documents/AppNotes/AN_111_Programmers_Guide_for_High_Speed_FTCSPI_DLL.pdf (http://url)
http://www.ftdichip.com/Support/Documents/AppNotes/AN_135_MPSSE_Basics.pdf (http://url)
Best regards
FTDI Community
-
[DllImport("libMPSSE.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern FTDI.FT_STATUS SPI_GetChannelInfo(uint index, ref FTDI.FT_DEVICE_INFO_NODE chanInfo);
dont work.
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct FT_DEVICE_LIST_INFO_NODE
{
public uint Flags;
public uint Type;
public uint ID;
public uint LocID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] SerialNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] Description;
}
[DllImport("libMPSSE.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern FTDI.FT_STATUS SPI_GetChannelInfo(uint index, ref FT_DEVICE_LIST_INFO_NODE chanInfo);
work correctly.
Have FTD2XX_NET package error?
Edit: Second Device is Sigma 2
-
Hi,
Channel B can only be opened using LibMPSSE when being used as SPI.
if both devices work fine if you open FT4232H first, then the device seems to be operating fine. Are FT4232H and SIGMA 2 connected in any way or are they just both connected to the PC?
one other thing that could be causing the issue is that FT4232H is a hi speed device and SIGMA 2 is a full speed device. But this should'nt really matter if the two devices are not connected to each other.
Best regards,
FTDI Community
-
AN_178 User Guide For libMPSSE - SPI says:
Structure definition of FT_DEVICE_LIST_INFO_NODE is in the D2XX Programmer's Guide.
I expected that it would not be a problem to use FT_DEVICE_INFO_NODE defined in FTD2XX_NET in LibMPSSE functions call. Unfortunately, this turned out to be a problem. When I define the structure like this
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct FT_DEVICE_LIST_INFO_NODE
{
public uint Flags;
public uint Type;
public uint ID;
public uint LocID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] SerialNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] Description;
}
everything works as it should. This solved the issue.
Both devices were connected only to the PC and were not otherwise connected.