FTDI USB problem

Mycroft2152

Senior Member
I've come across an interesting and confusing problem.

I am using an FTDI based USB to Serial converter board. When plugged in, Window's acknowledges it as COM6. The Program Editor (latest version) does not "see" it and even after a Refresh, it still does not appear on the list of COM ports.

I am using the standard FTDI driver and have inverted the TX and RX signal with MProg.

Myc
 

hippy

Technical Support
Staff member
You could try closing and re-starting the Programming Editor if you haven't and also check to see if it can be seen by HyperTerm, AXEpad or any other serial port using software. You may have to unplug and re-plug the USB once MPROG has run. A reboot wouldn't go amiss either.

Programming Editor finds serial ports by trying to open them in turn, so it looks like Windows / drivers are treating the port as not present or it's reporting that it's already been opened. Could be that something grabbed access to COM6 as soon as it was detected.
 

benryves

Senior Member
Programming Editor finds serial ports by trying to open them in turn, so it looks like Windows / drivers are treating the port as not present or it's reporting that it's already been opened. Could be that something grabbed access to COM6 as soon as it was detected.
This probably explains why Programming Editor appears to hang for up to a minute on my PC when initially loading or changing options - Bluetooth COM ports appear to be very slow to open, and they do tend to accumulate (I recently pared the number back down to five on my PC, but every time I pair a new Bluetooth device I get a new batch of COM ports). Would there be any possibility of skipping Bluetooth ports?
 

womai

Senior Member
I use the FTDI chip as well, works fine on my machine (Windows XP), with the standard FDTI VCP (virtual COM port) driver the programming editor shows the one I have plugged in right now as COM16 as it should (COM16 is what it got assigned to in Windows). Inverting the serial RX/TX lines does not have any influence on whether it gets recognized (of course it has a lot of influence on whether you can communicate with the Picaxe :)
 

hippy

Technical Support
Staff member
Bluetooth COM ports appear to be very slow to open
You're not the only one who has found Bluetooth ports slow to open, and it's not unheard of when trying to open a Bluetooth device, especially if not paired or connected, to "Crash Windows" or get complete hangs.

http://www.google.co.uk/#hl=en&q=bluetooth+crashes+windows

Would there be any possibility of skipping Bluetooth ports?
Possibly, but how to do that is challenging. There's nothing exposed to Programming Editor which says a COM port is Bluetooth and may crash and burn and no guaranteed way of determing Bluetooth devices from peeking Registry settings, and it all differs depending on which Windows Version.

The solution most developers adopt is to give the ability to select which ports are never allowed to be selected and set those manually, but that has problems of its own, not least how do you get into an application to exclude ports when the first thing that's done is to check which ports are present ?

Also when a new Bluetooth device gets added it may crash the PC later so the only safe way is to configure a list of all possible 255 ports which gets messy in seeing what has been excluded and what hasn't, and everything has to be excluded by default, which brings its own problems.

It is a real problem, and not one of Programming Editor's making, but I'll put it on the list of things to consider for the future.
 
Last edited:

benryves

Senior Member
Possibly, but how to do that is challenging. There's nothing exposed to Programming Editor which says a COM port is Bluetooth and may crash and burn and no guaranteed way of determing Bluetooth devices from peeking Registry settings, and it all differs depending on which Windows Version.
WMI would appear to be one possible way of doing this. Here's a snippet of VBScript:
Code:
' Use the following regular expression to identify Bluetooth COM ports.
Set bluetoothDetector = New RegExp
bluetoothDetector.Pattern = "Bluetooth.*?\(COM(\d+)\)"

' Search all COM/LPT ports (see http://msdn.microsoft.com/en-us/library/ms791134.aspx)
Set pnpPorts = GetObject("winmgmts:").ExecQuery("Select * From Win32_PNPEntity Where ClassGuid=""{4d36e978-e325-11ce-bfc1-08002be10318}""")
For Each pnpPort in pnpPorts	
	If bluetoothDetector.Test(pnpPort.Name) Then
		WScript.Echo pnpPort.Name
	End If
Next
Using a regular expression to detect which particular PnP port is a Bluetooth COM port does rub me up the wrong way a little, but the above code has been run through a rigorous application certification programme.
 

Mycroft2152

Senior Member
I stumbled across a solution the problem.

I first plugged in a different USB device and it showed up as COM5, then plugged in the "problem" device and it showed up as COM6. Both were acknowledged by the Programming Editor.

After unplugging both devices, I plugged in the "problem" device and it worked correctly as COM6.

Go figure.

Myc
 
Top