Download presentation
Published byDelphia McKinney Modified over 9 years ago
1
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK–
SPI, SCI, SI and SDIO Port/devices for Serial Data Communication
2
Microcontroller internal devices for SPI or SCI or SI
Synchronous Peripheral Interface (SPI) Port, for example, in 68HC11 and 68HC12 microcontrollers Asynchronous UART Serial Connect Interface (SCI), for example, SCI port in 68HC11/12 Asynchronous UART mode Serial Interface (SI), for example, SI in 8051
3
SPI: Synchronous Serial Peripheral Interface
4
SPI: Synchronous Peripheral Interface
Full-duplex Synchronous communication. The SPI is a synchronous serial interface in which data in an 8-bit (1 byte) can be shifted in and/or out one bit at a time. It can be used to communicate with a serial peripheral device or with another microcontroller (68HC12) with an SPI interface. The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides communication with external devices in Master or Slave Mode.
5
SPI Cont.… The Serial Peripheral Interface is essentially a shift register that serially transmits data bits to other SPIs. During a data transfer, one SPI system acts as the "master" which controls the data flow, while the other devices act as "slaves" which have data shifted into and out by the master. SCLK, MOSI and MISO signals for serial clock from master, output from master and input to master, respectively. Device selection as master or slave can be done by a signal to hardware input SS. (Slave select when 0) pin
6
Operation of SPI protocol
A slave device is selected when the master asserts its NSS/SS signal. If multiple slave devices exist, the master generates a separate slave select signal for each slave. The SPI system consists of two data lines and two control lines: Master Out Slave In (MOSI): This data line supplies the output data from the master shifted into the input(s) of the slave(s). Master In Slave Out (MISO): This data line supplies the output data from a slave to the input of the master. There may be no more than one slave transmitting data during any particular transfer. Serial Clock (SPCK/SCLK): This control line is driven by the master and regulates the flow of the data bits. The master may transmit data at a variety of baud rates; the SPCK/SCLK line cycles once for each bit that is transmitted. Slave Select (NSS/SS): This control line allows slaves to be turned on and off by hardware.
8
Operation of SPI protocol
Figure 1: Master/slave serial peripheral interface.
9
Operation of SPI protocol
Shift Register: loaded by SPI data and by data from SSPBUF Figure 1: Master/slave serial peripheral interface.
10
Operation of SPI protocol
Serial Buffer: Data is put here at the end of an SPI transfer, and data placed here for sending is loaded into the SSPSR for the next transfer. Figure 1: Master/slave serial peripheral interface.
11
Operation of SPI protocol
Control/ SPI CLOCK: SCK transmits the SPI clock from the Master to the Slave. SS controls if the slave is connected or idle. Figure 1: Master/slave serial peripheral interface.
12
Operation of SPI protocol
In the master SPI, the bits are sent out of the MOSI pin and received in the MISO pin. The bits to be shifted out are stored in the SPI data register, SP0DR, and are sent out most significant bit (bit 7) first. When bit 7 of the master is shifted out through MOSI pin, a bit from bit 7 of the slave is being shifted into bit 0 of the master via the MISO pin. After 8 clock pulses or shifts, this bit will eventually end up in bit 7 of the master.
13
Operation of SPI protocol
In the 68HC12 the least significant bit can be sent out first by setting the LSBF bit to 1 in the SPI Control Register. The clock, which controls how fast the bits are shifted out and into SP0DR, is the signal SCLK at PS6. The frequency of this clock can be controlled by the SPI baud rate register, SP0BR. The SS pin must be low to select a slave. This signal can come from any pin on the master, including its SS pin when it is configured as an output.
14
The SPI Registers An SPI transmission is always initiated by the master, and the peripheral device is called the slave. The master initiates a transfer by storing a byte in the SPI data register (SP0DR for 68HC12, SPDR for 68HC11). SP0CR1 : SPI Control Register 1 SP0CR2 : SPI Control Register 2 SP0BR : SPI Baud Rate Register SP0SR : SPI Status Register SP0DR : SPI Data Register
15
SPI Registers Addresses
16
Table 2: 68HC12 SPI Clock Rate Selection
17
Data and control lines of the SPI and the basic connection:
18
SPI Protocol Signals An SPI protocol specifies 4 signal wires.
Master Out Slave In (MOSI) - MOSI signal is generated by Master, recipient is the Slave. Master In Slave Out (MISO) - Slaves generate MISO signals and recipient is the Master. Serial Clock (SCLK or SCK) - SCLK signal is generated by the Master to synchronize data transfers between the master and the slave. Slave Select (SS) from master to Chip Select (CS) of slave - SS signal is generated by Master to select individual slave/peripheral devices. The SS/CS is an active low signal.
19
SPI SLAVE INTERNAL STRUCTURE
20
A full duplex data transmission can occur during each clock cycle.
21
Different types of configurations:
Suppose a master-microcontroller needs to talk to multiple SP Peripherals. There are 2 ways to set things up: Cascaded slaves or daisy-chained slaves Independent slaves or parallel configuration
22
Cascaded slaves or daisy-chained slaves
23
Independent slaves or parallel configuration
24
Examples 68HC11/12 uses synchronous serial communication (SPI Protocol) 68HC12 provides SPI communication device operation at 4Mbps. 68HC11 provides SPI communication device operation at 2Mbps.
25
Advantages of SPI Full duplex communication
Higher throughput than I²C protocol Not limited to 8-bit words in the case of bit-transferring Arbitrary choice of message size, contents, and purpose Simple hardware interfacing Typically lower power requirements than I²C due to less circuitry. No arbitration or associated failure modes. Slaves use the master's clock, and don't need precision oscillators. Transceivers are not needed. At most one "unique" bus signal per device (CS); all others are shared
26
Disadvantages of SPI Requires more pins on IC packages than I²C.
No in-band addressing. Out-of-band chip select signals are required on shared busses. No hardware flow control Multi-master busses are rare and awkward, and are usually limited to a single slave. Only handles short distances compared to RS-232 & CAN.
27
SCI: Serial Connect Interface Port
28
SCI: Serial Connect Interface Port
UART asynchronous mode port Full-duplex mode SCI programmable for transmission and for reception This interface uses three dedicated pins: transmit data (TXD), receive data (RXD), and SCI serial clock (SCLK). It supports industry-standard asynchronous bit rates and protocols as well as high-speed (up to 5 Mbps for a 40-MHz clock) synchronous data transmission. The SCI consists of separate transmit and receive sections whose operations can be asynchronous with respect to each other.
29
SCI Features Three-Pin Interface: TXD – Transmit Data
RXD – Receive Data SCLK – Serial Clock(Optional for Synchronous Communication) Kbps NRZ Asynchronous Communications Interface (50-MHz System Clock) 6.25 Mbps Synchronous Serial Mode (50-MHz System Clock) Multidrop Mode for Multiprocessor Systems: Two Wakeup Modes: Idle Line and Address Bit Wired-OR Mode On-Chip or External Baud Rate Generation/Interrupt Timer Four Interrupt Priority Levels Fast or Long Interrupts
30
SCI Full duplex signals
31
SCI Bit format The SCI configuration allows for a number of options for data transmission and reception. In the simplest configuration, ten bits are involved : a start bit (logical 0), the 8 data bits, and a stop bit (logical 1). An example transmission waveform, such as what you might see if you hooked up a logic analyzer to the TX pin, is shown above. Note that the data bits are sent lsb (bit 0) first, and msb (bit 7) last. Thus, the middle 8 bits in the pulse train below are sent in the order " " in a time domain signal, corresponding to an actual data byte of 0x2D (% ), which is an ASCII minus " - " sign.
32
SCI Bit format cont.…. The data rate out of/into the SCI is determined by the baud rate, and is an essential value to consider in any SCI setup. For our Dragon 12 running with a PLL controlled clock at 24 MHz, the baud rate is determined by the following formula: where BR is the content of the SCI1BDH/L Baud Rate Registers at addresses $00D0 and $00D1. For example, for a baud rate of 9600 (baud period ~ 100 usec) , we want a BR of about 156 = 9CH, so we write 00H to SCI1BDH and 9CH to SCI1BDL. Note that the baud rate is the same for transmission and reception for a given SCI port; we can't set one baud rate for transmission, and another for reception on a given port. SCI BAUD rate = 24,000,000/(16 x BR)
33
Serial Transmission Rules
The basic mechanics of serial transmission are simple: We load a data register with 8 bits of data; Once the data register is full, the data is transferred to a shift register automatically by the hardware; The data in the shift register are padded with a start/stop bit, and then shifted out on the TX pin a bit at a time at the set baud rate. For serial reception, the basic mechanics are reversed: We wait for the shift register connected to the RX pin to fill with serial data; Once the RX shift register is filled, the data is immediately transferred to the data register (the transfer is automatically done by the hardware); We then read the data register to see what data was received.
34
68HC11 SCI signals at Port PD
35
SI: Serial Interface Port
36
Serial Interface (SI) Port
UART 10T or 11T mode asynchronous port interface. Functions as USRT (universal synchronous receiver and transmitter) also. SI is therefore synchronous-asynchronous serial communication port called USART (universal synchronous-asynchronous receiver and transmitter) port. SI is an internal serial IO device in 8051.
37
SI Half-duplex signals Mode 0
38
SI Full duplex signals Mode 1, 2 or 3
39
SI Control bits programming
Mode 0− Half- duplex synchronous mode of operation, called. When a 12 MHz crystal is at 8051, and is attached to the processor, the clock bits are at the intervals of 1 μs. Mode 1 or 2 or 3− Full- duplex asynchronous serial communication.
40
SDIO: Secure Digital Input Output
41
Secure Digital Association (SD)
SD− an association of over 700 companies started from 3 companies in 1999 Created a new flash memory card format, called SD format for IOs. SDIO card has become popular feature in handheld mobile devices, PDAs, digital cameras and embedded systems. SD card size− just 0.14 cm × 2.4 cm × 3.2 cm. Allowed to stick out of the handheld device open slot, which can be at the top in order to facilitate insertion of the SD card
42
SDIO card host controller
A processing element functions used SDIO host controller to process the IOs. Controller may include SPI controller to support SPI mode for the IOs and also supports the needed protocol functionality internally
43
SD Memory Card System Concept
1. Read-Write Property • Read/Write (RW) cards • Read Only Memory (ROM) cards. 2. Supply Voltage • High Voltage SD Memory Cards: V. • Dual Voltage SD Memory Cards –Dual Voltage SD Memory Cards that can operate within the voltage range of Low Voltage Range (T.B.D) and V. 3. Card Capacity • Standard Capacity SD Memory Cards: up to and including 2 G bytes • High Capacity SD Memory Cards: up to and including 32 GB(specification 2.00). • 2 types of High Capacity SD Memory Card are specified. Type A (Single State Card) has single High Capacity memory area Type B (Dual State Card) has both High Capacity memory area and Standard Capacity memory area. In Type B card, only one memory area can be used at any given time.
44
4. Speed Class 5. Bus Topology
Four Speed Classes are defined and indicate minimum performance of the cards • Class 0 - These class cards do not specify performance. It includes all the legacy cards prior to specification 2.00, regardless of its performance • Class 2 - Are more than or equal to 2 MB/sec performance. • Class 4 - Are more than or equal to 4 MB/sec performance. • Class 6 - Are more than or equal to 6 MB/sec performance. 5. Bus Topology The SD bus includes the following 9 signals: CLK : Host to card clock signal CMD : Bidirectional Command/Response signal DAT 0 - DAT 3 : 4 Bidirectional data signals. VDD , VSS1 , VSS2 : Power and ground signals.
45
6. Bus Protocol Communication over the SD bus is based on command and data bit streams that are initiated by a start bit and terminated by a stop bit. • Command: a command is a token that starts an operation. A command is sent from the host either to a single card (addressed command) or to all connected cards (broadcast command). A command is transferred serially on the CMD line. • Response: a response is a token that is sent from an addressed card, or (synchronously) from all connected cards, to the host as an answer to a previously received command. A response is transferred serially on the CMD line. • Data: data can be transferred from the card to the host or vice versa. Data is transferred via the data lines.
46
SDIO Signals Description
47
Figure-3: Command Token Format
Figure-4: Response Token Format
48
Figure-5: “no response” and “no data” Operations
Figure-6: (Multiple) Block Read Operation
49
Figure-7: (Multiple) Block Write Operation
50
Figure-8: Data Packet Format - Usual Data
Data packet format for the SD card: Usual data (8-bit width): The usual data (8-bit width) are sent in LSB (Least Significant Byte) first, MSB (Most Significant Byte) last sequence. But in the individual byte, it is MSB (Most Significant Bit)first, LSB (Least Significant Bit) last. Figure-8: Data Packet Format - Usual Data
51
SDIO Hardware Design
52
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK–
Parallel port at devices
53
Parallel Port 8-bit IOs Short distances, generally within a circuit board or IC or nearby external devices
54
Parallel Port in the device
Advantage− Number of 8 bits over the wires in parallel. High data transfer rate Disadvantage− More number of wires Capacitive effect in parallel wires reduces the length up to which communication in parallel can take place. High capacitance results in delay for the bits at the other end undergoing transition from 0 to 1 or 1 to 0. High capacitance can also result in noise and cross talk (induced signals) between the wires.
55
Parallel Port Interfacing
IO device interfacing-circuit with the processor and system buses and connections to external peripherals/systems Parallel port inputs I0 to I7 may be from a keypad controller. Parallel port outputs O0 to O7 may be output bits to LCD display output controller. 𝐁𝐫 𝐢 and 𝐁𝐫 𝐨 buffers may be provided at bidirectional I/O port. 𝑩𝒓 𝒊 => Input Buffer Register 𝑩𝒓 𝒐 => Output Buffer Register
56
Parallel port interfacings for keypad, LCD display and modem
57
Parallel IO port handshaking and Interfacing
58
Handshaking signals to and from an external peripheral device for input at port
Device makes a strobe request to port, STROBE after it is ready to send the byte and System I/O port sends the acknowledgement, PORT READY. System I/O port receives data in buffer and then issues an interrupt signal, INT to processor to enable an ISR execution
59
Handshaking signals to and from an external peripheral device for Output at port
Device sends the message ACKNOWLEDGE when and the I/O device port ends the BUFFER FULL signal to inform that the is buffer full. The processor is sent the INTERRUPT REQUEST message, when the transmitting-buffer is empty (available for next write)
60
Port Interrupt to processor
When receiving-buffer is full (available for next read) When transmitting-buffer is empty (available for next write)
61
Bidirectional Port Handshaking signals
STROBE PORT READY BUFFER-FULL ACKNOWLEDGE INTERRUPT REQUEST
62
SELF STUDY TOPICS Parallel Port Interfacing with Switches and LEDS.(SELF STUDY TOPICS) Parallel Port Interfacing with Matrix Keyboard. (SELF STUDY TOPICS) Parallel Port Interfacing with Stepper Motor Parallel Port Interfacing with LCD Controller.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.