Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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
1  
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
1  
The code that uses the SPI serial comm is a device driver. –  David Schwartz Dec 11 '12 at 0:53

2 Answers 2

up vote 0 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.