cancel
Showing results for 
Search instead for 
Did you mean: 

UART vs USB

PhKloth1
Associate II

I have a question regarding the logic of the USB cdc transfer. But beforehand let me show you approach up to now

0693W00000NppTDQAZ.pngThis is in a rough version my program, It will be used for feedback control. So a fixed frequency of the main loop is mandatory (as I use digital filters inside the data processing). At the same time I would like to stream my data to a PC to supervise the data. I realizied this by using UART_DMA_Transmit. So then the transfer is not influencing (or at least only little) my main loop.

At the moment I forward 9 16bit variables via UART to the PC. With a baud rate of 500000 I get a transfer frequency of roughly 700µs.

When using comercial I/O cards (NI, Meilhaus,...) they are able to transfer the data at much higher speeds. I suspect that here the USB cdc transfer is used.

I have seen some examples for this type of transfer. But in every example one sends data in a polling mode. Concerning my must have fixed main loop for the feedback control, is there a similar way to use USB transfer without blocking the main loop?

Thanks in advance for your help!

2 REPLIES 2
Muhammed Güler
Senior III

Baud rate does not matter when transferring with usb cdc. data is transmitted at maximum speed. If you are going to use only usb cdc, it does not affect the workflow of the data so much.

PhKloth1
Associate II

Hey,

thanks for your reply. What do you mean with not so much? Do I Just save my message into the USB puffer and give the signal to transfer and the USB is taking care of the sending process? Analog to DMA? And additionally I read multiple times that USB has only an advantage when sending bigger data and there is no gain in speed for this short message. So you should gather some data and then send them in a bigger package.

The data monitoring on the PC does not have to be in real time.