Page 1 of 1

Virtual COM Interface via USB

Posted: Mon Oct 07, 2013 11:13 pm
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!

Re: Virtual COM Interface via USB

Posted: Tue Oct 08, 2013 1:13 am
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.

Re: Virtual COM Interface via USB

Posted: Tue Oct 08, 2013 12:21 pm
by Ross
I think a good place to start is the USB Device examples here: https://www.xmos.com/support/downloads/ ... =XCORE-USB

Re: Virtual COM Interface via USB

Posted: Tue Oct 08, 2013 12:22 pm
by Ross
There is also a vitual com port example here: https://github.com/xcore/sc_usb/tree/ma ... e_usb_vcom

Re: Virtual COM Interface via USB

Posted: Tue Oct 08, 2013 10:00 pm
by klausix
Hi Ross!
Thanks a lot, this seems to be what I've been looking for :-)

Best regards,
Klaus!!

Re: Virtual COM Interface via USB

Posted: Wed Oct 09, 2013 12:40 am
by TSC
Sorry klausix, I obviously completely misunderstood what you wanted to do.

I'm glad Ross could point you in the right direction.

Re: Virtual COM Interface via USB

Posted: Wed Oct 09, 2013 10:34 am
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!