Serial versus Parallel Data Transfers

Similar documents
EE 308: Microcontrollers

Design with Microprocessors

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

Lecture 25 March 23, 2012 Introduction to Serial Communications

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Serial Peripheral Interface (SPI)

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

COMP2121: Microprocessors and Interfacing. I/O Devices (I)

PARALLEL COMMUNICATIONS

spi 1 Fri Oct 13 13:04:

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

Interfacing Techniques in Embedded Systems

Amarjeet Singh. January 30, 2012

< W3150A+ / W5100 Application Note for SPI >

a Serial Peripheral Interace (SPI). Embedded RISC Microcontroller Core Peripheral

Microcontrollers and Interfacing

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Understanding SPI with Precision Data Converters

More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI

Serial Communications

SPI: Serial Peripheral Interface

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut

Menu. What is SPI? EEL 3744 EEL 3744 SPI

Serial Communication. Simplex Half-Duplex Duplex

Introduction to I2C & SPI. Chapter 22

Interfacing a Hyper Terminal to the Flight 86 Kit

Universität Dortmund. IO and Peripheral Interfaces

UART TO SPI SPECIFICATION

Marten van Dijk, Syed Kamran Haider

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

SPI 3-Wire Master (VHDL)

OUTLINE. SPI Theory SPI Implementation STM32F0 SPI Resources System Overview Registers SPI Application Initialization Interface Examples

or between microcontrollers)

CprE 488 Embedded Systems Design. Lecture 4 Interfacing Technologies

Microprocessors & Interfacing

Basics of UART Communication

Programming Microcontroller Assembly and C

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

ATmega640/1280/1281/2560/2561

Raspberry Pi - I/O Interfaces

Serial Communications

Summer 2003 Lecture 21 07/15/03

Growing Together Globally Serial Communication Design In Embedded System

The 8237 DMA Controller: -

PCI Host Controller 14a Hardware Reference Release 1.2 (October 16, 2017)

EE 308 Spring Using the 9S12 SPI

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

SPI Block User Guide V02.07

Laboratory Finite State Machines and Serial Communication

Serial Buses in Industrial and Automotive Applications

Using the Z8051 MCU s USI Peripheral as an SPI Interface

University of Technology

Lecture 14 Serial Peripheral Interface

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

17. I 2 C communication channel

Serial Communication. Spring, 2018 Prof. Jungkeun Park

Temperature Sensor TMP2 PMOD Part 1

Doc: page 1 of 8

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Serial Peripheral Interface (SPI) Host Controller Data Sheet

From Datasheets to Digital Logic. synthesizing an FPGA SPI slave from the gates

i_csn i_wr i_rd i_cpol i_cpha i_lsb_first i_data [15:0] o_data [15:0] o_tx_ready o_rx_ready o_rx_error o_tx_error o_tx_ack o_tx_no_ack

4X4 Driver Shield Manual

Tektronix DPO Demo 1 Board Instruction Manual

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

Part 1 Using Serial EEPROMs

Chapter 13 Direct Memory Access and DMA-Controlled I/O

To be familiar with the USART (RS-232) protocol. To be familiar with one type of internal storage system in PIC (EEPROM).

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

Addressing scheme to address a specific devices on a multi device bus Enable unaddressed devices to automatically ignore all frames

Computer Architecture: Part III. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

The MC9S12 in Expanded Mode Using MSI logic to build ports Using MSI logic to build an output port Using MSI logic to build an input port

Freescale Semiconductor, Inc.

International Journal of Advance Engineering and Research Development DESIGN AND IMPLEMENTATION OF SPI PROTOCOL

Doc: page 1 of 6

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

Fig.12.5 Serial Data Line during Serial Communication

Real Time Embedded Systems. Lecture 1 January 17, 2012

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

11.4 THE SERIAL PERIPHERAL INTERFACE (SPI)

AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL

A Simple Parallel Input Port

ELEC 4200 Lab#10 Interrupting SPI Receiver for use with a Processor Core

COMP2121: Microprocessors and Interfacing

CN310 Microprocessor Systems Design

ET-BASE AVR ATmega64/128

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

1.3inch OLED User Manual

Serial Peripheral Interface (SPI) Last updated 8/7/18

HC12 Built-In Hardware

App Note Application Note: Addressing Multiple FPAAs Using a SPI Interface

EECS 373 Design of Microprocessor-Based Systems

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

FPGA Implementation Of SPI To I2C Bridge

Instructions Involve a Segment Register (SR-field)

Transcription:

Serial versus Parallel Data Transfers 1 SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA

Serial communications Most communications is carried out over serial links Fewer wires needed Less electronics needed Must run faster Examples Ethernet USB Universal Serial Bus USART Universal Synchronous and Asynchronous serial All available in Receiver and Transmitter (RS232/COM ports) ATmega128 as onchip peripherals I 2 C Inter Integrated Circuit SPI Serial Peripheral Interface 2

Parallel or serial? Convert numbers expressed in terms of several bits (many signal lines) into a stream of 0s, 1s on a single line (and a Clock). Advantage: A convenient way to reduce the number of Electrical signal lines by factors of 8, 16, 32, 64. 3 Disadvantage: For the same transfer rate the electronics must be faster by factors of 8, 16, 32, 64.

A shift register converts 4-bit parallel to serial 4 When Parallel load is set, the S/R bits on the Flip Flops are arranged to latch in the bits on the data bus (1 bit on each Flip Flop) On each rising edge of the clock, The Data on the Flip Flops is put on the Q (Output Line), which appears at the input of the next flip flop. The input data is latched, and the bits move from one FF to the next It takes 4 clock cycles to move the 4 bits out to the serial ouput line A Four Bit Shift Register Composed of 4 D-Flip-Flops Parallel to Serial Conversion

Data is placed on the parallel data bus PL: Data Loaded into Flip Flops On Clock edge Data is shifted from output of each FF to the Input of the next NEILNEIL - Microprocessor Course 5

8 Bit Parallel to Serial Shift Register 6

Parallel to Serial Conversion: Parallel load a number then clock it out 7 clock D0 D1 D2 D3 D4 D5 D6 D7 Output 0 1 1 0 1 1 0 1 1 1 Tick 1 1 0 1 1 0 1 1 2 Ticks 1 1 0 1 1 0 1 3 Ticks 1 1 0 1 1 0 4 Ticks 1 1 0 1 1 5 Ticks 1 1 0 1 6 Ticks 1 1 0 7 Ticks 1 1 8 Ticks 1

Serial to Parallel shift register At each clock transition, the data is shifted to the next flip-flop in the chain We need to keep track of how many clock pulses we have sent to know when the full byte is on the outputs 8

Suppose you feed a 1 : 9 D0 D1 D2 D3 D4 D5 D6 D7 0 0 0 0 0 0 0 0 0 1T 1 0 0 0 0 0 0 0 2T 1 1 0 0 0 0 0 0 3T 1 1 1 0 0 0 0 0 4T 1 1 1 1 0 0 0 0 5T 1 1 1 1 1 0 0 0 6T 1 1 1 1 1 1 0 0 7T 1 1 1 1 1 1 1 0 8T 1 1 1 1 1 1 1 1

10 Serial/parallel peripheral module on AVR There are several different peripheral functional units on the AVR which you can use. The Serial Peripheral Interface (SPI) unit allows the AVR to communicate to external devices using a simple serial protocol. M. Neil - Microprocessor Course

11 SPI module on AVR At the heart of the SPI module is a shift register. You can write parallel 8- bit data to the SPI module which is then automatically clocked out through the shift register to external pins. The SPI unit can also read in serial data from external pins and present it as parallel 8-bit data to your program. M. Neil - Microprocessor Course

SPI timing diagram 12 Note that as well as selecting clock polarity, you can also select whether the MSB or the LSB is output first!

The 74HC164 Shift Register: Serial to Parallel Serial Data In 13 Clock *Reset Parallel out

74HC164 Function Table 14

SPI code example SPI_MasterInit: ; Set MOSI and SCK output, SS* also as output, all others input ldi r17,(1<<ddb2) (1<<DDB1) (1<<DDB0) out DDRB,r17 ; Enable SPI, Master, set clock rate fck/16 ldi r17,(1<<spe) (1<<MSTR) (1<<SPR0) out SPCR,r17 ret SPI_MasterTransmit: ; Start transmission of data (held in r16) out SPDR,r16 Wait_Transmit: ; Wait for transmission to complete sbis SPSR,SPIF rjmp Wait_Transmit ret 15

High Level Design 16 The Project: Parallel To Serial 8-Bits of data (Parallel) ATmega128 SPI 8-Bits of data (Serial) PORTB Data Clock Serial to Parallel 8-bit Serial Data Shift Register 74HC164 8-Bits of data (Parallel) LEDs

17 Low Level Design Wire up LEDs so that you can see the data arrive on the output Wire up a switch to the MR* line to allow you to clear the Shift Register outputs (make sure you understand how this works) Data: PORTB2 (MOSI) 2 1 8 Q7 DSB Q6 Q5 DSA Q4 Q3 Q2 Q1 Q0 CP MR 74HC164 13 12 11 10 6 5 4 3 9 LEDs to read output VCC The clock and data bits should come from the SPI outputs that can be found on PORTB Clock: PORTB1 (SCK) 1.0k VCC

The Serial Link Test Program 18 Start Send new pattern to SPI Delay several seconds SPI Clocks the data 8 times into 164 using PORTB Look at the LEDs

Task Plan: Construct a device that will turn 8-bit parallel data into serial data + clock using the on-chip SPI peripheral. 19 Construct a device that will receive serial data, convert them to parallel data and display them using LEDs. Write a program that will send several patterns down your serial link and demonstrate that it works.