Usb2ser
Electronegativity
Posts: 311
It's me again.
I'm about to buy a USB2ER device and try to communicate between my PC and an SX chip.
I'm a bit mystefied by the details though.
Does anyone have sample code I could look at?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
I'm about to buy a USB2ER device and try to communicate between my PC and an SX chip.
I'm a bit mystefied by the details though.
Does anyone have sample code I could look at?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
Comments
·· There really isn't any sample code...The device is simply meant to provide a COM Port to a computer via the USB Port.· So you plug the device into the USB Port on the computer, with the driver installed you have a COM Port.· Now you send your serial data to/from the device via the TTL level serial outputs on the other end.· Bringing DTR high will also pull the 4th line low, which can be used as a reset or something.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Also, make sure you have the FTDI driver installed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 8/31/2005 12:55:00 AM GMT
This is perfect!
You have saved me muchness of time I am sure.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
I sent a message into support yesterday, so I apologize if you are seeing this for a second time --- I've also emailed FTDI per Ryan's@parallax suggestion.
Do you have any details on how to use the USB2SER with (custom) baud rates in excess of 1mbps? I'm not worried with the SX details perse as much as the Windows side of things. I've done serial programming on the Windows platform, and so I'm not a newbie in that regard. Can I just use
handle = CreateFile("COMx", etc flags, params, etc);
and use SetCommState(handle, dcb); where dcb is the windows data structure that defines baud rate, parity, etc?
Using the VCP drivers that you redistribute, is it business as usual on the PC for accessing that port, except that I can pass high(and non-standard) baud rates? I've read some stuff on FTDI's site regarding modifying .ini's to setup the "default" baud rates to map to higher datarates.
I'll be bit-banging data to the UART to achieve higher rates. Should be easy enough on the SX side "creating" a start/stop bit, and the data bits....
Keith
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· I don't know either...Never had a need to do something like this.·
Electronegativity,
·· Have you gotten things working on your end?· Fortunately HyperTerminal won't adversly affect the USB2SER, however, HyperTerminal has settings that affect the DTR line, and thusly can affect the 4th output on the USB2SER if you use it for anything.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I di manage to solder an SX20 onto a Sparkfun breakout board last night though. [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
I've attached that excel spreadsheet.· It lists all the acceptable baud rates you can pass to the driver.
I'm also going to test these higher datarates, and I'll report back once I get some kind of conclusive result.
It seems so simple, that something has to be wrong here! [noparse]:)[/noparse]
If you want to learn more about serial ports and USB, then go here:
www.lvr.com/
Jan Axelson has books on each subject, plus a ton of info available on the site itself.
Thanks, PeterM
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
I got my USB2SER setup, and communicating with some software I wrote in VC++ in .net.
The answer is a resounding YES.· Using FTDI's Virtual Com Port drivers, the device shows up as COMx where x is the next available number.· In my case, it's COM4.· It was just a matter of modifying the DCB structure that contains the baudrate and passing it to SetCommState() as usual.· You can pass literally any number you like, provided it's one of the ones listed on the supported spreadsheet I attached in my original message.
It's surprisingly transparent.· Most apps seem to work fine with it.
I've attached some sample VC++ code that I wrote just to test basic functionality.· This is a console app that opens the port, sets the port up with baud rate etc, and goes into an infinite loop reading from the serial port.· I also included a line which shows how to write to the port.
Notice this is barebones code -- it doesn't rely or depend on any non-standard external headers, libraries, etc.· To build it, simply select "New Project", pick Visual C++ Projects, select the "Managed C++ Application" template, give it a name, and then just replace the default .cpp file with mine.
FYI
Keith
Which pin on the FT232BM does the "reset" pinout on the USB2SER correspond to?
I want to use the USB2SER in a USB powered device and need to handle the suspend mode.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I wonder if this wire is hot...
Docs: http://www.parallax.com/dl/docs/prod/acc/USB2SERDocs.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 9/9/2005 11:21:22 PM GMT