Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My understanding is that serial communication is for direct CPU-to-CPU (or microcontroller-to-microcontroller) communication along a serial bus.

My understanding is that a device driver is for device-to-CPU or device-to-microcontroller communication; essentially it tells the CPU how to read/write data to certain pins for correctly communicating with the raw device.

Am I correct here, or way off base? If anything that I have said so for is not true or misunderstood, please clarify/correct me! I'm basically looking for a litmus to use to help me decide when I need to use, say, SPI or I2C or UART (serial comm) or just use a driver. Thanks in advance.

share|improve this question
Serial communication is device to device, not CPU to CPU. (The device would be a serial interface on each side.) – David Schwartz Dec 10 '12 at 15:18
Thanks @DavidSchwartz (+1) - can you be more specific by what you mean when you say device. Wouldn't an MCU (say, an ARM CPU and some LEDs all on the same PCB) qualify as a device? In that case, isn't it the ARM CPU on the MCU communicating with the CPU on whatever its connected to (serially)? I guess I'm not seeing the difference between device and CPU. Thanks again. – pnongrata Dec 10 '12 at 15:25
A CPU is something that does computations and makes decisions. A device is something that connects a CPU to a peripheral or some other device. A microcontroller includes both a CPU and some devices on the same chip. – David Schwartz Dec 10 '12 at 16:35
Thanks again @DavidSchwartz (+1), but still not understanding when a device driver is needed, and when serial comm is more appropriate. – pnongrata Dec 10 '12 at 17:18
The code that uses the SPI serial comm is a device driver. – David Schwartz Dec 11 '12 at 0:53
up vote 1 down vote accepted

So does this mean that device drivers are what actually use SPI serial comm? If so, SPI comm is available to user applications, so why use device drivers?

Many reasons:

You might want to write code that can use various different types of serial communications without having to change the higher-level code.

You might want to moderate access to the serial port from different applications.

The serial interface may be most efficient with interrupts and you need to handle interrupts in low-level code.

And so on.

share|improve this answer

The term "serial communication" refers to any digital communication that transfers one bit at a time. This is opposed to parallel communication, where multiple bits are transferred at a time.

Your misunderstanding of serial communication comes from confusing a particular application of serial communication with the idea of serial communication. There are actually a huge number of applications.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .