Virtual COM Interface via USB

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
klausix
New User
Posts: 3
Joined: Mon Jul 09, 2012 8:55 pm

Virtual COM Interface via USB

Post by klausix »

Hi All!
I am looking for code that shall run on an XS1-L01
additionally to (or as part of) the USB Audio code.
It should implement a virtual COM port on the PC/Mac and on the other end (the XMOS) a channel end where i can connect a tread to.
(More or less a FT232 implemented in software inside the XMOS).
The task of the thread is freely implementable:
E.g. it can output the data coming from the virtual COM connection to a pin to implement a real serial port on the XMOS.
Or only parse the data so the XMOS can be easily controlled throuch commands sent via the virtual COM from the PC.

Has anybody ever implemented this?
Or could at least give me a hint how to start its implementation?

Any help would be highly appreciated!!

Thanks a lot in advance,
Klaus!


User avatar
TSC
Experienced Member
Posts: 111
Joined: Sun Mar 06, 2011 11:39 pm

Post by TSC »

You'll probably want to start with the sc_uart software component from github.

sc_uart runs on an XMOS device and implements a uart with one pin as receiver and one pin as transmitter. Both pins must be 1-bit ports.

The two pins would then be connected to your PC through a serial-USB converter (assuming your PC doesn't have a native RS-232 serial port). This FT232 board would work. It uses 3.3 V logic level just like XMOS ICs. Just connect RX, TX and GND.

Warning! Don't connect an RS-232-USB converter or any RS-232 port directly to an XMOS IC because the large voltage swings on it (around +/- 12 V) will damage the XMOS IC which uses 3.3 V logic level.

You can modify the example code in sc_uart to create two channels (eg. uart_rx, uart_tx) that connect to some other part of your application's code.
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

I think a good place to start is the USB Device examples here: https://www.xmos.com/support/downloads/ ... =XCORE-USB
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

There is also a vitual com port example here: https://github.com/xcore/sc_usb/tree/ma ... e_usb_vcom
klausix
New User
Posts: 3
Joined: Mon Jul 09, 2012 8:55 pm

Post by klausix »

Hi Ross!
Thanks a lot, this seems to be what I've been looking for :-)

Best regards,
Klaus!!
User avatar
TSC
Experienced Member
Posts: 111
Joined: Sun Mar 06, 2011 11:39 pm

Post by TSC »

Sorry klausix, I obviously completely misunderstood what you wanted to do.

I'm glad Ross could point you in the right direction.
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

klausix wrote:Hi Ross!
Thanks a lot, this seems to be what I've been looking for :-)

Best regards,
Klaus!!
No problem :) Let is know how you get on!
Post Reply