140 likes | 230 Views
ECE 447: Lecture 12. Serial Communication. ECE447: Serial I/O Pins. PD0 - RxD (SCI) PD1 - TxD (SCI) PD2 - MISO (SPI) PD3 - MOSI(SPI) PD4 - SCK (SPI) PD5 - SS (SPI). ECE 447: SCI – Asynchronous Communication. Each device uses its own clock
E N D
ECE 447: Lecture 12 Serial Communication
ECE447: Serial I/O Pins PD0 - RxD (SCI) PD1 - TxD (SCI) PD2 - MISO (SPI) PD3 - MOSI(SPI) PD4 - SCK (SPI) PD5 - SS (SPI)
ECE 447: SCI – Asynchronous Communication • Each device uses its own clock • Clocks run at the same rate, but are not synchronized. • For communications between remote devices • Devices may be transmitters, receivers, or both.
ECE 447: SCI – Asynchronous Communication • Data is sent “framed” to indicate the start and stop of a transmit unit (byte) • Start bit is a ‘0’, and stop bit is a ‘1’ • Hardware typically adds and removes the framing bits from the data • Systems typically use one start and one stop bit, however 2 or 1½ stop bits may be used.
ECE 447: SCI – Asynchronous Communication • Parity is used to detect single-bit errors. • It refers to the number of ‘1’ bits in a data unit. • The quantity of ‘1’ bits cab be either “Even” of “Odd” • Not all errors can be detected. If two bits change, the parity may still be correct.
ECE 447: SCI – Asynchronous Communication • Parity is used to detect single-bit errors. • It refers to the number of ‘1’ bits in a data unit. • The quantity of ‘1’ bits cab be either “Even” of “Odd” • Not all errors can be detected. If two bits change, the parity may still be correct.
ECE 447: SCI – Asynchronous Communication • Serial data is measured in bits per second (BPS), Baud refers to the rate at which the signal changes. • 9600 Baud does not nessarily mean 9600 BPS. ie: 9600 baud, 8 data, no parity, 1 stop bit for a total of 10 bits per 8 bits of data. 8/10 x 9600 Baud = 7680 BPS (data)
ECE 447: SPI – Synchronous Communication • Devices share the clock signal. • Clocks can be run at higher rates using SPI • Devices can be chained in a bus or cascade topology. (device must support cascading) • Devices act as either a master or a slave, with only one master allowed at any given time.
ECE 447: SPI – Synchronous Communication • Master initiates transfer by writing data to its register. • Data is shifted out the MOSI pin and data is shifted in at the same time from MISO. • The clock is automatically driven for 8 cycles. • When complete the shift register data is transferred to the receive data register.
ECE 447: SPI – Synchronous Communication • Slave initiates transfer by writing data to its register. • Data is moved to the shift register, but is not moved out unit a clock signal is received from the mater. • For each clock pulse one bit is transferred out MISO (automatically driven for 8 cycles). • When complete the shift register data is transferred to the receive data register.