Author Topic: USB CDC device emulation on a PC  (Read 13892 times)

asanchez

  • Member
  • ***
  • Posts: 2
USB CDC device emulation on a PC
« on: October 24, 2011, 11:04:04 am »
Question to all USB savvies:

I need to know if this at all possible:

I have 2 systems:

System1: This is an embedded controller which is running a USB CDC stack, and when connected to System2 via USB, it creates a virtual COM port at System2

System2: This is a PC which is running a Labview application which is acting as main controlling platform and it communicates serially with System1, via the virtual serial COM port created when System1 is connected. This application essentially sets parameters and gathers data from System1.

What I need to do (if at all possible) is to replace System1 with a PC that is running an application (i.e. Visual Studio), or other, which basically emulates the behaviour of the controller (System1). This basically means my application must behave like a CDC device in respect to USB and present a serial COM port to System1 to be able to pass the data back and forth via the CDC emulated channel.

Questions:
Is this at all possible, since the PC acts as a USB host?
What is the easisest way to implement this?
Are there off-the-shelf components that can be used to simplify the implementation process?
Is there a sample code that explains how to do this?

Thanks,

Alex



Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB CDC device emulation on a PC
« Reply #1 on: October 24, 2011, 11:58:53 am »
System2 is sending data to a COM port. It doesn't have to know or care what hardware interface the COM port uses. So you could use this setup:

System2 PC with USB/serial converter OR physical serial port

Null modem cable or connector to route each TX to RX on the serial connection.

System1 PC with USB/serial converter OR physical serial port

System2's software will need to select the COM port that connects to System1.

System1's software will need to select the COM port that connects to System2 and emulate whatever communications the device was performing.

I have example code for serial communications here:

http://www.lvr.com/serport.htm#my_example_code

Jan

asanchez

  • Member
  • ***
  • Posts: 2
Re: USB CDC device emulation on a PC
« Reply #2 on: October 27, 2011, 03:43:44 pm »
 :) Thanks Jan...