cancel
Showing results for 
Search instead for 
Did you mean: 

STM32R7: USB Com Virtual port sometimes duplicate bytes

semler
Associate II
Posted on March 01, 2018 at 19:03

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 

5 REPLIES 5
Posted on March 01, 2018 at 19:13

Maybe you lost chars 'o world

ping'
Posted on March 01, 2018 at 19:14

Add counter to the string  to prove it...

Posted on March 01, 2018 at 21:00

I am affraid it is not that problem:

ping

hellhello (1)

ping

hellhello (2)

ping

hello (3)

ping

hello (4)

ping

hellhello (5)

ping

hello (6)
Posted on March 01, 2018 at 21:17

Yes, data duplication is unlikely here. More likely it's a problem with a driver as you mentioned at the beginning.

Posted on March 06, 2018 at 10:41

Problem solved. I simply rise the hclk to 48MHz