# USB CDC Virtual COM Port Device



## mwpau (Sep 25, 2017)

Greetings all,

First up, i'm super new to FreeBSD, so please go easy on me.
(i'm rather familiar with Linux though)

I have a STM32 microcontroller based USB device that presents itself as a CDC VCP device.
I'm using ST's USB CDC device library.

On attaching the device i see in the kernel log:

```
ugen0.2: <STMicroelectronics STM32 Virtual ComPort> at usbus0
umodem0 on uhub1
umodem0: <STMicroelectronics STM32 Virtual ComPort, class 2/2, rev2.00/2.00, addr2> on usbus0
umodem0: data interface 1, has no CM over data, has no break
```

On trying to use the VCP at /dev/cuaU0, data flows as it should for a random amount of time, and then fails.
The device works perfectly with both Windows and Linux, so this does appear to be a FreeBSD driver issue.

Does anyone has any advice on how I should go about solving this issue?

Thanks in advance!


----------



## SirDice (Sep 26, 2017)

mwpau said:


> On trying to use the VCP at /dev/cuaU0, data flows as it should for a random amount of time, and then fails.


Fails how? Does it time-out? Or stop responding? Did you check things like flowcontrol (RTS/CTS, Xon/Xoff)?


----------



## nakal (Sep 26, 2017)

You haven't said how you use the device /dev/cuaU0. What executable is it?


----------



## mwpau (Sep 26, 2017)

I've been testing in a VirtualBox VM... which now i think about it isn't the best idea.
I'll setup a PC and try again.
I'm pretty confident it'll still have issues, but at least i'll be able to rule out the VM.


----------



## SirDice (Sep 26, 2017)

mwpau said:


> I've been testing in a VirtualBox VM... which now i think about it isn't the best idea.
> I'll setup a PC and try again.
> I'm pretty confident it'll still have issues, but at least i'll be able to rule out the VM.


Yeah, I'm not that confident about USB pass-through. Definitely try this on "real" hardware.


----------



## nerozero (Jan 31, 2018)

Hello ... so ... this error does take place on live systems. 

how to reproduce:
 You need STM32F103, STM32F407, or any STM32 with USB support. 
 Code : easiest way to use auto generated by Cube MX - USB CDC Device.
 then - all you need is plug your newly flashed board to  FreeBSD machine  in DMesg message will appear:
`umodem0: data interface 1, has no CM over data, has no break`

here is usbconfig output:

```
usbconfig -d ugen0.4 dump_device_desc
ugen0.4: <DevEL DevEL-HWCodec-DEV> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0002  <Communication device>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x03eb
  idProduct = 0x6133
  bcdDevice = 0x0200
  iManufacturer = 0x0001  <DevEL>
  iProduct = 0x0002  <DevEL-HWCodec-DEV>
  iSerialNumber = 0x0003  <00000000001A>
  bNumConfigurations = 0x0001
```

This USB CDC Device working on linux flawlessly. you get /dev/ttyACMx on linux.


----------

