cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID or CDC

hilwan
Associate II
Posted on March 12, 2014 at 11:01

Hi, 

I have implemented the CDC(VCP) class on my F3 discovery and it work very well. Now, i want to send a integer data each 25µs. So i have to set up my rate speed of my board to 1600Kbps.

On the PC side, the speed rate of my serial port is limited to 115Kbps.

Is there any way to get the PC and the board working at the same speed 1600Kbps?

Actually,i implemented HID class, my device is detected as HID device but i haven't tested the communication yet. I saw that the maximum speed is 64Kbytes/s. So, this solution can't resolve my problem.

Do you have any idea how can i achieve this stuff ?

I really need to use USB to communicate with my Board.

Thanks in advance for any help,

Best regards 

15 REPLIES 15
zzdz2
Associate II
Posted on March 17, 2014 at 15:37

Nice benchmark, it looks like the number of packets is limited to 16.

hilwan
Associate II
Posted on March 18, 2014 at 16:17

Thanks guys for your participation.

Let me explain me how i want to make my USB communication.

I'm converting an input data with ADC of 50Khz sample rate,then i'm doing some processing. This is done in a while loop.

I measured the frequency output of this loop and it's about 40Khz.

The value computed after processing is stored into an  integer variable(4 Bytes),  then it's sent by The USB. To verify in Host side that the data is received correctly, i affect to this variable a value that is incremented in loop while.

1) The problem that i had is some values are jumped for example if send (1...8000 values), i receive 1,2,3,4,5, 7,8,10.. ect.

2) But if i feed these values in 64B buffer, in this case i send data by USB each 40Khz/64,i can receive my values in order but some packets are lost. that's mean i get my 64 values every  700 Hz, it isn't the real time for me because i want x0 at t0 and so on.

May be the problem came from my C# host application, but i can't figure out how the PC side could limit the rate speed ?

I hope that my explanations are very clear

hilwan
Associate II
Posted on March 19, 2014 at 09:22

Any Idea please ? or it is not clear ?

Thanks in advance

chen
Associate II
Posted on March 19, 2014 at 10:29

Hi

''Any Idea please ? or it is not clear ?''

I think it is clear :

You have STM32 working as USB CDC device.

You have PC C# application reading the data from the STM32 USB CDC.

The data from the STM32 is being lost.

Do not know if it is the STM32 USB CDC stack or the PC C# application.

You have 2 unknowns : the STM32 and the PC C# application.

Which will be easier to prove/disprove?

Can you have the STM32 send the data in plain ascii and look at the data on the PC in a terminal program (Hyperterm, I prefere Teraterm

http://ttssh2.sourceforge.jp/index.html.en)

This will tell you if the PC VCP driver is capturing all the data.

It takes your C# program out of the unknowns.

zzdz2
Associate II
Posted on March 19, 2014 at 10:40

2)But if i feed these values in 64B buffer, in this case i send data byUSB each 40Khz/64,i can receive my values in order but some packets arelost. that's mean i get my 64 values every  700 Hz, it isn't the realtime for me because i want x0 at t0 and so on.

 

Make sure TX_STAT is set to NAK before loading new data.

After loading buffer you set TX_STAT to VALID and after successful transmit peripheral sets it to NAK.

You can also try double buffering to improve data flow.
hilwan
Associate II
Posted on March 27, 2014 at 15:02

Hi,

Sorry of my late response.

Thnaks very much for your help.

I will try your suggestions ant let you know of my progress.

Best regards