Forcing the Parallax Serial/USB adapter to a particular COM port number
davejames
Posts: 4,047
Hi All,
Has anyone attempted to force the Serial/USB adapter to a particular COM port number ala the FTDI application note:
"Configuring FTDI's VCP Drivers to use Location IDs (AN232B-07)"
I've emailed FTDI but have had no response.
Thanks,
DJ
Has anyone attempted to force the Serial/USB adapter to a particular COM port number ala the FTDI application note:
"Configuring FTDI's VCP Drivers to use Location IDs (AN232B-07)"
I've emailed FTDI but have had no response.
Thanks,
DJ
Comments
I wish you luck.
-Phil
A bit 'o the why:· I have a "BS2-product" that requires input from the user.· The user will provide this info from a dialog box running on a PC.· The product communicates via USB using the FTDI Serial/USB converter chip.· This FTDI chip creates a 'virtual com port' (VCP) so I would never know which COM port is being assigned, and I seem to have the need to know which COM port is in use when opening a COM port on the PC·(did that make sense?).· I'm writing the dialog box in Visual C++ and the 'CreateFile" command used to setup the COM port requires a unique COM port number.· So, hence the problem.· My solution was to alter the '.inf' file that the FTDI chip uses upon startup and hard code the COM port to a high port number (99) so it wouldn't clash with other COM port usage.
Pray tell...what's the 'royal pain' you've experienced?· Is changing the locids item in the .inf not the only thing one would have to do?
Thanks,
DJ
In your case, though, I'd skip all that rigamarole and use the stampw.exe program to interrogate the available serial ports for a working BASIC Stamp. This you should be able to do from your C++ program, since stampw has a command line interface, in addition to being a GUI. Then just open whichever port it reports back with.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
OK - so what do you do, then, if you're attempting to set up communication between a PC and a BS2 using the Serial/USB adapter?· If I need to know what COM port the FTDI has chosen, how do I detect that so I might set the C++ CreateFile statement correctly?
Phil - you mentioned stampw.exe.· What's that?· I just finished perusing the Parallax site and couldn't locate any info on it.
Mr. Savage - thanks for the warning.
DJ
·
-Phil
I suppose I could invoke stampw.exe via the C++ ShellExecute() command, detect the current BS2 com port, and then use that port to write data to the BS2 via CreateFile().
I guess...?
Thanks very much for the input.· I need to go away and think about this.
DJ
·
-Phil
Perhaps I don't understand piping as well as I should, but where in the documentation mentioned does STAMPW send anything back to the invoker?
TIA
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
The invoker must be able to capture STDOUT, which is something most scriptable shell commands can do. At least that's the way it works for me. Even if STDOUT can't be captured directly, it can be piped to a temporary file for subsequent reading.
-Phil
In my bones, I know there must be a more straightforward approach.
Now you see why I thought about forcing the FTDI chip to a particular port.
What're you guys doing up so late anyway?
DJ
-Phil
When I press the 'identify' button in the Stamp Editor, there's a bit of delay, the LEDs on the Serial/USB adapter flash, and then the info is displayed.· Obviously there is some sort of interrogatoin occuring.· It's that particular process in which I'm intrigued.
If there are any Parallax apps people monitoring this thread, can you tell me what process is used to detect the USB port an FTDI chip uses on start-up?
As always - much thanks.
DJ
The Stamp Editor doesn't know anything about USB ports — only serial ports, since that's how a properly-installed USB-to-serial adapter is registered. The Editor polls all the available non-occupied serial ports for a Stamp by sending a reset, followed by an ID request. Parallax used to publish the protocol details for this, IIRC, but I can't find it on their website anymore.
-Phil
Addendum: Have you looked at the docs in the "Developer" subdirectory to the Stampw program folder? Everything you need for communicating with Stampw is detailed there, including a /PIPE option I wasn't aware of. It renders the necessity for deep knowledge of the ID protocol unnecessary, IMO.
Post Edited (Phil Pilgrim (PhiPi)) : 11/19/2008 6:56:18 PM GMT
Ok - that's some insight as to the process.· Now I guess I have to pin down Parallax as to the particulars.
So unless anyone reading this has "the particluars", I'm going to call this thread closed and go pester Parallax directly.
Thanks to all for the involvement,
DJ
See my addendum above.
-P.
······· http://www.parallax.com/tabid/441/Default.aspx
under:
······ BASIC Stamp Tokenizer Version: 1.16
Time go read some more!
Later,
DJ
OK - thanks again.· I'll go dig through and read those too.
Later,
DJ
I had time to sit down today and string them together in a simple VB app, my comfort level with C++ is pretty low so I didn't try to convert it over but possibly you are able to do that.
The attached doc is an Open Office document saved as an MS Office 6 document and contains the complete code for polling the available serial ports for a BS2. Although it will identify all ports it is unable to access a port that is in use.
The way in which it works is guided by Parallax's Tokenizer documentation, this is also my main reason for posting the code, if you are creating your routines with reference to the Tokenizer docs it is possible you will come across an error in the reset sequence, the attached file has the error corrected.
Jeff T.
Thanks for the info.
What I've found in the last week is that Microsoft Visual Studio 2005 C++ has been expanded with a new class specific to dealing with COM port issues. I've been using VS 6.0 C++ for the last 10 years which doesn't. I guess there's a lesson to be learned here concerning staying aware of a product's updates.
The VS 2005 C++ code samples I've recently seen look similar to your VB app.
I'll be bitin' the bullet and purchasing VS 2005 here in the next couple weeks for home use. I found out that I have acess to it at work so I have something to play with immediately.
Thanks again and I trust you had a happy Thanksgiving Day (if you're in the states, that is...).
Dave