AnsweredAssumed Answered

STM32R7: USB Com Virtual port sometimes duplicate bytes

Question asked by semler.miloslav on Mar 1, 2018
Latest reply on Mar 6, 2018 by semler.miloslav

Hello,

recently I am trying to make some device communicating via USB virtual com port. Firstly, device has sometimes problem to enumerate itself:

 

[1922765.320415] usb 1-1.2: new full-speed USB device number 34 using ehci-pci
[1922765.414063] usb 1-1.2: device descriptor read/all, error -32
[1922765.484587] usb 1-1.2: new full-speed USB device number 35 using ehci-pci
[1922765.556713] usb 1-1.2: device descriptor read/64, error -32
[1922765.732912] usb 1-1.2: device descriptor read/64, error -32
[1922765.909118] usb 1-1.2: new full-speed USB device number 36 using ehci-pci
[1922765.934083] usb 1-1.2: New USB device found, idVendor=0483, idProduct=5740
[1922765.934089] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1922765.934092] usb 1-1.2: Product: STM32 Virtual ComPort in FS Mode
[1922765.934095] usb 1-1.2: Manufacturer: STMicroelectronics
[1922765.934097] usb 1-1.2: SerialNumber: 12345678
[1922765.934655] cdc_acm 1-1.2:1.0: This device cannot do calls on its own. It is not a modem.
[1922765.934689] cdc_acm 1-1.2:1.0: ttyACM5: USB ACM device

 

But there is problem with sending string buffer. When I want to send some packet via usb sometimes I get duplicated first four bytes. Example (first line send to device from terminal, second got back):

 

ping
HellHello world
ping
Hello world
ping
Hello world
ping
HellHello world
ping
Hello world

 

I use 8MHz crystal on HSE as clock source multiplied by PLL (@96MHz) to get 24MHz AHB and SYSCLK and 48MHz USB clock 

Outcomes