AnsweredAssumed Answered

USB device and CDC class

Question asked by Pillet.Vincent on Jun 17, 2014
Latest reply on Jun 25, 2014 by Pillet.Vincent
Hi all,

I'am using USB device CDC class to communicate datas with a host. But I've a strange problem. (I'am using the STM32F429i Disco platform)

The STM32 code create a memory area with 00 01 02 03 04 ... datas and then configure the USB driver to send 2048 bytes to the host starting at the beginning of the memory area.

With CoolTerm terminal on my Mac (x86) it seems to work, and display the correct datas : 00 01 02 03 04 ....

Now, with the same code on the STM32 but connected to my Linux virtual machine (on the Mac), I receive datas but always starting with 1D 1E 1F .... The 29 (0x1C) first bytes are always missing .... OK, let's assume that the virtualization is the problem even though I never had any problem with USB/RS232 cables.

Now I connect the STM32 to our linux embedded board (Arm, kernel 3.6). The host now do not receive anything ... Even with a simple : cat /dev/ttyACM0 (BTW, the USB CDC device is correctly enumerated on the host).

Now on a real Linux machine (x86, kernel 3.2.0) , I receive : 01 00 03 02 ... (I guess the swap is due to Arm => x86 arch).

Code on STM32 :

USBD_CDC_SetTxBuffer(&hUSBDDevice, (uint8_t *) pBuffer, size);
while (USBD_CDC_TransmitPacket(&hUSBDDevice) != USBD_OK) {};

Why is this working in the Mac, but not on all Linux Machine ?
Any idea of what going on ?

Thanks,
BR,
Vince.

Outcomes