Hi Toby, In the past we have had problems with other FTDI USB devices in the system (like serial adapters). It ends up being like multiple KFLOPs in the system and when board 0 is selected it selects the first one which is based on the order they were detected and such. I thought that we fixed this by ignoring FTDI devices that don't have KFLOP (or KMotion or Dynomotion) in the description. Check in the Device Manager and see what the description for the Serial Adapter is. But a woraround might be to open the board using a USB Descripter. This is tied to a specific USB plug and will never change. See: http://dynomotion.com/Help/MultipleBoards.htm Regards TK
Group: DynoMotion |
Message: 8919 |
From: Toby Rule |
Date: 1/23/2014 |
Subject: KFLOP with USB Serial adapter |
Hi Tom,
I am finally getting around to implementing a fix for this issue.
Can I use the USB Location Identifier when connecting using the following method:
KMotion_dotNet.KM_Controller kmcontroller = new KMotion_dotNet.KM_Controller(usbLocationId);
Is there a dotNet way to get a list of USB location ID’s? Or do I need to call the native function?
Thanks,
Toby
Group: DynoMotion |
Message: 8920 |
From: Tom Kerekes |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby, Yes you should be able to pass the USB ID to create the controller object as you show. See the GetBoards member function: /// <summary> /// Get Boards checks the list of connected board locations and returns the total board count /// </summary> /// <param name="numberofboards">returned total board count</param> /// <returns>array of USB locations for all boards</returns> public int[] GetBoards(out int numberofboards) {
try { int[] list = new int[256]; numberofboards = 0; int boards = -1; KM_dotnet_Interop_ListLocations(_InstanceHandle, ref boards, ref list[0]); numberofboards = (int)boards; return
list; } Regards TK
Group: DynoMotion |
Message: 8927 |
From: Toby Rule |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
Hi Tom,
Thanks for the info. But it looks like this isn't going to work.
When both the usb-to-serial adapter and the KFLOP are connected to the hub, KMotion will not connect to the KFLOP. Here is how I tested:
KMotion 4.31F
FTDI comm port adapter drivers were the latest available on website - 2.08.30
Dynomotion driver 2.8.14
KFLOP FTDI drivers – 2.8.30.9
Behavior was observed with two different serial adapters (different brands, same chipset)
·
KFLOP has external power supply.
·
PC has both USB-Serial adapter and KFlop connected.
·
Launch KMotion
·
KMotion reports board is DISCONNECTED. No boards listed under “USB Locations”
·
Disconnect/reconnect the KFLOP. Still reports DISCONNECTED.
·
Disconnect USB-Serial adapter. CONNECTED, Board 0@ 0x0.
·
Reconnect serial adapter. KFLOP stil CONNECTED. "USB Locations" shows Board 1 @ 0xFFFFFFFF.
·
After a few seconds, Board 1 disappears
·
Shut down and re-started KMotion – DISCONNECTED.
·
Shut down KMotion
·
Unplugged serial adapter
·
Reconnected serial adapter
·
Launched KMotion – DISCONNECTED
In my application, I tried:
kmcontroller = new KMotion_dotNet.KM_Controller(0x0);
This threw an exception in the case where the serial adapter was plugged in first.
In the application, I tried
int[] boards = kmcontroller.GetBoards(out numberOfBoards);
numberOfBoards return 0. So it’s not seeing the KMotion at all.
In the state where KMotion doesn't connect, both devices (KFLOP and serial adapter) appear in device manager, and appear to be working properly.
I really need to get this issue fixed, either by changing the machine configuration so it works with both devices, or else change to a non-FTDI serial driver.
Regards,
Toby
Group: DynoMotion |
Message: 8929 |
From: Tom Kerekes |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
I don't understand why you are having the problem or would need to specify the USB Location.
It is true that the low level FTDI driver will list a mixture of Dynomotion Boards mixed
with other devices that use an FTDI chip. But KMotionDLL should only report back devices from the List where the device description contains "Dynomotion", "KFLOP", or "KMotion" within it.
With the two devices connected and looking in Device manager what are the descriptions for the two devices?
Below is the code section that
checks the descriptions. I don't have a way of reproducing the problem. Would it be possible for you to debug this? Set a breakpoint in the code below. You would need to setup Visual studio to debug KMotionServer with the breakpoint set. Then launch KMotion.exe (or anything that would try to connect) and the breakpoint should be encountered.
ftStatus = FT_GetDeviceInfo( ftHandle, &ftDevice, &deviceID, SerialNumber, Description,
NULL );
if (ftStatus == FT_OK) { FT_Close(ftHandle);
if (strstr(Description,"KFLOP")== NULL && strstr(Description,"KMotion")== NULL &&
strstr(Description,"Dynomotion")== NULL) { // remove it from the list for (int k=i+1; k<*nlocations; k++) list[k-1] = list[k]; // shift up (*nlocations)--;
i--; // redo this slot since it was deleted and things shifted up } }
Regards TK
Group: DynoMotion |
Message: 8931 |
From: Toby Rule |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
I’ll give this a try and report back.
Group: DynoMotion |
Message: 8933 |
From: Toby Rule |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
Hi Tom,
In Device Manager list - The boards appear as "KFLOP - Motion Controller 4.XX" and "USB Serial Converter"
I attached the debugger to KMotionServer.exe while my code was running.
With both KFLOP and serial converter connected, nlocations == 2 and it goes through "for (i=0; i<*nlocations; i++)" loop twice. After the FT_GetDeviceInfo function call, on both loops, I see the same return values:
SerialNumber = 0x03cfdaa8 "A6018T3N" Description = 0x03cfdab8 "FT232R USB UART" deviceID = 67330049 ftDevice = 5
If I have only the serial adapter connected, then nlocations == 1 and I see the same values.
If I have only the KFLOP connected, I get nlocations == 1, but of course it never hits FT_getDeviceInfo.
If I connect the kflop, launch the program, and then connect the serial adapter (everything works correctly in this case) then nlocations = 2, but it never hits FT_getDeviceInfo.
Does this tell you anything? Is there anything else you would like me to test?
Thanks,
Toby
Group: DynoMotion |
Message: 8934 |
From: Tom Kerekes |
Date: 1/23/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby, That is great data thanks. But it still doesn't make sense. I don't know why you say: If I have only the KFLOP connected, I get nlocations == 1, but of course it never hits FT_getDeviceInfo.
With one device it should get the device info and verify that it is a KFLOP On my system with one KFLOP connected I get nlocations == 1 and it calls FT_getDeviceInfo and gets: SerialNumber = "KFQTSNKS" Description = "KFLOP - Motion Controller" deviceID = 67367473 ftDevice = 5
Oh I think I remember a quirk with the FTDI List Devices request in that if the device is already open then the data in the list for that device is garbage (or actually just not filled in). That is the reason for filling the list with all values of -1.
I think your method of attaching after your application is running would already have the KFLOP device open.
Sorry I don't understand what is going on. Please repeat the test but run KMotionServer before your App and attach and set the breakpoint before any devices are opened.
Regards TK
From: Toby Rule <trule@...> To: "DynoMotion@yahoogroups.com" <DynoMotion@yahoogroups.com> Sent: Thursday, January 23, 2014 3:14 PM Subject: RE: [DynoMotion] KFLOP with USB Serial adapter
Hi Tom,
In Device Manager list - The boards appear as "KFLOP - Motion Controller 4.XX" and "USB Serial Converter"
I attached the debugger to KMotionServer.exe while my code was running.
With both KFLOP and serial converter connected, nlocations == 2 and it goes through "for (i=0; i<*nlocations; i++)" loop twice. After the FT_GetDeviceInfo function call, on both loops, I see the same return values:
SerialNumber = 0x03cfdaa8 "A6018T3N" Description = 0x03cfdab8 "FT232R USB UART" deviceID = 67330049 ftDevice = 5
If I have only the serial adapter connected, then nlocations == 1 and I see the same values.
If I have only the KFLOP connected, I get nlocations == 1, but of course it never hits FT_getDeviceInfo.
If I connect the kflop, launch the program, and then connect the serial adapter (everything works correctly in this case) then nlocations = 2, but it never hits FT_getDeviceInfo.
Does this tell you anything? Is there anything else you would like me to test?
Thanks,
Toby
Group: DynoMotion |
Message: 8937 |
From: Toby Rule |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
Hi Tom,
I launched KMotionServer before launching the application. I set breakpoints after FT_GetDeviceInfo in KmotionIO.cpp and KMotionDLL_Direct.cpp
With just the KFLOP connected, it breaks in KMotionIO.cpp.
numdevs = 1
ftHandle = 0x004f1228 ftDevice = 5 deviceID = 67367473 SerialNumber = 0x02b1d5e4 "KFTFE1OY" Description = 0x02b1d59c "KFLOP - Motion Controller"
With both devices (KFLOP and serial adapter) connected - Breaks in KMotionIO
numdeves=2
I get the following results both times through the loop.
ftHandle = 0x02561228 ftDevice = 5 deviceID = 67330049 SerialNumber = 0x0292d5e4 "A6018T3N" Description = 0x0292d59c "FT232R USB UART"
I noticed that with both devices connected, after FT_ListDevices is called, the first two elements of the list array are 0,0. Are these board identifiers?
I would expect them to be different.
Regards,
Toby
Group: DynoMotion |
Message: 8942 |
From: Tom Kerekes |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
After calling FT_ListDevices the list should contain the USB IDs of the devices. If I connect two KFLOPS I see two valid USB ID numbers in the list.
So yours are both zero? But with only one device attached it is correct??
Regards TK
Group: DynoMotion |
Message: 8943 |
From: Toby Rule |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
With One device – a KFLOP – attached, one of the list items is zero, the rest are -1. I assume this is correct? It works properly, anyway.
With TWO devices attached – one KFLOP and one usb adapter – the first two items in the list are zero, the rest are -1.
Group: DynoMotion |
Message: 8945 |
From: Tom Kerekes |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
I found this app note which probably applies to USB Locations also. But it seems like it should show KFLOP properly and not just a zero.
http://www.ftdichip.com/Support/Knowledgebase/index.html?whyismydevicenotdetected.htm
Could there be something on your system thinking KFLOP is a serial port and opening it?
Is something opening your serial port?
Regards TK
Group: DynoMotion |
Message: 8946 |
From: Tom Kerekes |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
I suppose zero is a valid USB Descripter ID but it is unlikely. Try plugging KFLOP into a different USB slot. It should not be zero then for sure.
Regards TK
Group: DynoMotion |
Message: 8949 |
From: Toby Rule |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
I noticed that when I was testing using KMotion, and I plugged the KFLOP into different slots on the PC, and on an external hub, KMotion always reported zero
board number under “USB Locations”. This seemed to contradict your MultipleBoards.htm help document. However, KFlop still worked correctly, as long as the serial converter wasn’t plugged in when KMotion launched. So, it seems that the USB device number is
the telltale symptom.
I’ll try with different computers and see how it acts. Maybe it is a driver problem, or a problem with the USB controller? I know it’s not just my PC, because
my co-worker reported similar problems at another site.
Thanks for your help with this. I think this kind of interaction makes a good case for open-source device libraries. It would be nice to set a breakpoint
in FTD2XX.dll.
Toby
Group: DynoMotion |
Message: 8955 |
From: Tom Kerekes |
Date: 1/24/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
FYI I tried plugging one KFLOP into a USB Hub and a second direct and I see two valid non-zero numbers:
0x2163 0x2114
Regards TK
Group: DynoMotion |
Message: 9010 |
From: Toby Rule |
Date: 1/27/2014 |
Subject: Re: KFLOP with USB Serial adapter [2 Attachments] |
Hi Tom,
OK, I have some more information. I found that the issue with reporting 0x0 Location ID only occurs on the USB 3.0 ports. On USB 2.0 ports, the correct ID
is reported, and the KFLOP and serial adapter work correctly.
I found this on StackOverflow. Apparently, I just have to avoid USB 3.0 ports on Windows 7?
http://stackoverflow.com/questions/14469218/opening-an-ftdi-device-based-on-bus-location-id
I may try a serial adapter based on the Prolific chipset, although these don’t seem to have as good a reputation as FTDI.
Toby
Group: DynoMotion |
Message: 9015 |
From: Tom Kerekes |
Date: 1/27/2014 |
Subject: Re: KFLOP with USB Serial adapter |
Hi Toby,
Thanks for the info. I wonder if we could work around this issue by obtaining a list of Serial Numbers instead of USB Locations? Then go through the Descriptions and if there is only one KFLOP and the Caller requested board zero then just use that one.
Regards TK
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |