0
votes

I'm trying to wrap my head around this one, but haven't been able to find an answer to this. A little context (also, I don't know if this is the perfect sub). I'm finishing my undergraduate studies in electronic engineering. We haven't studied too much communication, and I haven't found the need for it until now. I'm currently sensing and digitizing a signal of 150 Hz bandwidth at a rate of 400 Hz. I store 1 s worth of sampling in a microprocessor with a built-in serial-USB adaptor, so I can connect it directly to my PC and, currently using Matlab, dump the content of the uP to my computer in a loop of 10 s. So 1 s sampling, dumping; 1 s sampling, dumping... total of 10 times.

From what I've gathered, the uP I/O UART+drivers and something similar in the host (my computer) permits the USB to be treated as if it were a serial port using an rs protocol. This protocol would allow the use of interrupts were I to code it with C#, C++ or something similar.

But from a USB protocol perspective, it is the host who initiates the device IN packages by polling it at a determined rate.

So, my question is. When using a USB port as a serial virtual port, is this virtual port limited to the USB protocol, or is it somehow overridden (from a polling perspective)? I'm guessing the former.

I'm also mostly curious, do all motherboards include usb-to-serial interfaces, or do computer handle this via software?

I've been reading as I was writing this, and I'm guessing some of the things I've said point to a deep lack of understanding, so please be gentle. I'm aware I need to read more and more.

Thank you very much.

1
"This protocol would allow the use of interrupts were I to code it with C#, C++ or something similar." -- If your program executes under an OS, then the OS has full control of the I/O. Your program is merely transferring data with system buffers when it "reads" and "writes". - sawdust

1 Answers

0
votes

I am not an expert on deep USB knowledge, but I would answer your questions based on my practical use of VCP (Virtual COM Port).

For the polling question, it is the latter. Once the host recognizes the device as serial port, the device works in almost the same way as built-in serial ports (non-existing for most modern computers). The only difference seems some parameter setting, like LatencyTimer for VCP.

The host recognizes VCP according to USB protocol, and works by using the device manufacturer driver. It does nothing to do with computer mother board (except generic USB support) if I am correct.

It seems to me you don't need to worry too much about the USB. Although serial port is kind of obsolete hardware, but it is pretty well supported by all major software toolkit.