Index
- General information
- I2C
- SPI
- Microwire
- Maxim 3-wire
- Maxim/Dallas 1-Wire bus
- Interfacing techniques and questions on them
Serial buses information page
General information
This page concentrates on links to inter-IC serial buses. When this page talks about 2-wire or 3-wire interfaces, this wire number is the number of control lines. In addition to this those interfaces generally need a common ground, which is the ground plane in circuit board applications and a seprate wire in inter-circuit-board connections.
The serial bus interfaces are widely used for interfacing EEPROMs, data converters and many peripheral chips to microcontrollers. They are also often used for inter-microcontroller communication. Serial bus system are also used to build control buses inside equipments like TV receivers, AV amplifiers and cellular phones.
The major advantage of usign s serial bus is the small number of wires needed. A major disadvantage of serial interfacing is the tradeoff of speed for space. The processor???s I/O port spends a relatively large amount of time communicating with a serial device. Consequently, serial converters with throughput rates above 500 ksps are uncommon.
I2C
What Is the I2C Interface?
I2C is an acronym for Inter Integrated Circuit bus. I2C is a 2-wire serial interface standard defined by Philips Semiconductor in the early 1980's. It's purpose was to provide an easy way to connect a CPU to peripheral chips in a TV-set. The BUS physically consists of 2 active wires and a ground connection. The active wires, SDA and SCL, are both bidirectional. Where SDA is the Serial DAta line and SCL is the Serial CLock line.
The key advantage of this interface is that only two lines (clock and data) are required for full duplexed communication between multiple devices. The interface typically runs at a fairly low speed (100kHz to 400kHz). With I2C, each IC on the bus has a unique address. Chips can act as a receiver and/or transmitter depending on it's functionality.
The I??C-bus is devoloped by Philips to maximize hardware efficiency and circuit siplicity. The I2C interface is a simple master/slave type interface. Simplicity of the I??C system is primarily due to the bidirectional 2-wire design, a serial data line (SDA) and serial clock line (SCL), and to the protocol format. Bi-directional communication is facilitated through the use of wire and connection (the lines are either active-low or passive high). The I2C Bus protocol also allows collision detection, clock synchronization and hand-shaking for multi-master systems. The clock is always generated by the master, but the slave may hold it low to generate a wait state. In most systems the microcontroller is the master and the external peripheral devices are slaves.
The maximum number of devices connected to the I2C bus is dictated by the maximum allowable capacitance on the lines, 400 pF, and the protocol's addressing limit of 16k; typical device capacitance is 10 pF. The I2C protocol has 127 addresses available. The original vision was to assign addresses by device function, but when Philips began to sell microcontrollers for I2C, the address could be programmed, eliminating the need for a Philips-assigned address.
A device that controls signal transfers on the line in addition to controlling the clock frequency is the master and a device that is controlled by the master is the slave. The master can transmit or receive signals to or from a slave, respectively, or control signal transfers between two slaves, where one is the transmitter and the other is the receiver. I2C bus support more than one master connected to one bus.
The I2C bus is an innovative hardware interface which provides the software designer the flexibility to create a truly multi-master environment. It is possible to combine several masters, in addition to several slaves, onto an I??C-bus to form a multimaster system. If more than one master simultaneously tries to control the line, an arbitration procedure decides which master gets priority.
To begin communication, the bus master (typically a microcontroller) places the address of the device with which it intends to communicate (the slave) on the bus. All ICs monitor the bus to determine if the master device is sending their address. Only the device with the correct address communicates with the master.
Philips' has over 150 CMOS and bipolair chips who are I??C-bus compatible, and also some other companies make ICs with I2C control interface.
The I2C master is generally implemented with special I2C controller (sometimes integrated to microcontroller) or sometimes using a microcontroller and some software running on it. Both approaches are possible in typical one master I2C system. The multi-master system is not generally implemented with microcontroller software because it is extremely difficult to meet all the I2C Bus timing spec-ifications using software. For a true slave or multi-master system, some interface hardware is necessary (like START & STOP bit detection).
Data can be transferred at a rate of up to 100 kbps in Standard mode, up to 400 kbps in Fast mode, and up to 3.4 Mbps in High-Speed mode. Each slave on the bus is identified by a unique address. In Standard mode, 7-bit addressing is used. In other modes, slaves can have 7- or 10-bit addresses. The number of devices that can be connected to the same bus is limited by the maximum bus capacitance of 400 pF. Only the master generates the clock, but transmission speed can be adjusted to the internal operating rate of the addressed slave. This adjustment is made by clock stretching, in which the slave keeps the SCL pulled low until it is ready to continue.
Nowadays there are many different variations of I2C in use. Each of the various I2C derivatives defines a slightly different direct current (DC) electrical interface. I2C by definition is 5V. High and low thresholds, rather than being of fixed value, are a function of VCC for some parts. There are hacks to make I2C to work also on other voltages than 5V. In different application device addrressing can vary. A liberal fixed addressing scheme is quite common (different type of devices get for example four addresses each). ACCESS.bus uses dynamic addressing scheme.
- Access.Bus Mouse Application Code For The Microcontroller - pdf file Rate this link
- Analog switch expands I2C interface - This circuit allows connection of the master host to very many I2C devices and prevents the master from addressing multiple slaves at the same time. This circuit allows you to add three times more devices on the bus I2C than is normally possible. Rate this link
- AVR302: Software I2C Slave Implementation Rate this link
- Centronics to I2C converter inside DB25 connector Rate this link
- I2C (Inter-Integrated Circuit) Bus Technical Overview and Frequently Asked Questions (FAQ) Rate this link
- Analog switch frees stuck I??C bus - The dual-channel PCA9540 I2C multiplexer often breaks up an I2C or SM bus or allows you to use devices with the same addresses on the same bus. In same error cases this system can lock up I2C bus. To free up a stuck I2C bus, this circuit controls the supply voltage to force a hardware reset. Rate this link
- The I2C FAQ Rate this link
- I2C interfacing via PC parallel port Rate this link
- I2C protocol implementation sources - C source code of I2C driver Rate this link
- I2C Links Rate this link
- Interfacing I2C Devices with a PIC16C84 (Interfacing with a Philips PCF8574 8-Bit I/O Expander) - The discussion focuses on the implementation of low level I2C routines which are common to interfacing with most I2C devices. These routines are discussed in the context of interfacing with an Philips PCF8574 8-bit I/O device. The intent is to illustrate the use of the low level I2C routines. Rate this link
- Software Implementation of I2C Protocol - The I2C interface is modest in its hardware resource requirements, because only a single pair of signal lines is needed: serial data (SDA) and serial clock (SCL). Data can be transferred at a rate of up to 100 kbps in Standard mode, up to 400 kbps in Fast mode, and up to 3.4 Mbps in High-Speed mode. Each slave on the bus is identified by a unique address. Rate this link
- Software Implementation of I2C Bus Master - This application note describes the software implementation of I2C interface routines for the PIC16CXXX family of devices. Only the master mode of I2C interface is implemented in this application note. This implementation is for a single master communication to multiple slave I2C devices. In addition to the low level single master I2C routines, a collection of high level routines with various message structures is given. These high level macros/routines can be used as canned routines to interface to most I2C slave devices. As an example, the test program talks to two Serial EEPROMs (Microchip.s 24LC04 and 24LC01). Rate this link
- ST7 S/W IMPLEMENTATION OF I2C BUS MASTER - The goal of this application note is to implement an I2C communications software interface for devices which have no I2C peripheral. The software of this application performs I2C master transmitter and master receiver functions. The master chosen here is a ST72324 and the slave is an EEPROM (M24C08). The program described in this application note is in C language. Rate this link
- The I2C-bus and how to use it (including specifications) Rate this link
- Software reset uses I??C I/O port - You can use this circuit to allow the I2C or SMBus to control device resets in a system by using the PCA9554 I2C I/O-port IC. Rate this link
- The I 2 C serial bus: theory and practical consideration using Philips low-voltage PCF84Cxx and PCD33xx mC families (AN168) Rate this link
- Two-transistor circuit replaces IC - Linear Technology's recently introduced LTC4300 chip buffers I2C clock and data lines to and from a hot-swappable card. This task is difficult because the IC must work bidirectionally, meaning that you can simultaneously and actively drive both sides. However, as is sometimes the case, you can replace a complicated circuit by a simple one without much loss of performance. For example, transistors and resistors replace the entire IC. Two npn transistors, connected head-to-head, form the heart of the circuit. The two-transistor circuit offers the additional benefit of acting as a level translator between two logic levels, for example 3.3V and 5V. Rate this link
- More on two-transistor circuit - Information on two-transistor logic level translator circuit Rate this link
SPI
The SPI-bus is a 4-wire serial communications interface used by many microprocessor peripheral chips. The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that is standard across many Motorola microprocessors and other peripheral chips. It provides support for a low/medium bandwidth (1 megabaud) network connection amongst CPUs and other devices supporting the SPI.
SPI bus is basically a relatively simple synchronous serial interface for connecting low speed external devices using quite minimal number of wires. SPI (serial peripheral interface) is an interface standard defined by Motorola on the MC68HCxx line of microcontrollers. A synchronous clock shifts serial data into and out of the microcontrollers in blocks of 8 bits. SPI - Serial Peripheral Interface. SPI is used frequently in handheld and other mobile platform systems.
SPI bus is a master/slave interface. Whenever two devices communicate, one is referred to as the "master" and the other as the "slave" device. The master drives the serial clock. When using SPI, data is simultaneously transmitted and received, making it a full-duplexed protocol.
Motorola's names for the signals are as follows: SCLK for serial clock, which is always driven by the master: MISO is master-in slave-out data: MOSI is master-out slave-in data. In a typical application, connect the microcontroller's SCLK to the converter's SCLK input, connect the MISO to the converter's DOUT pin, and connect the MOSI pin to the converter's DIN pin. Serial protocols such as SPI, a chip-select input is required to enable the IC. Using this chip-select signal it is possible to connect many ICs to same SPI bus in parallel. If there is a chip-select (CS) signal in use, it can be driven by a spare microcontroller general-purpose output. Every IC connected to bus needs it's own chip-select signal line. Thus, when 10 devices are on the bus, 10 chip-select lines, in addition to the shared clock and data lines, are needed to select the appropriate device.
- App Note 085: Interfacing the DS1620 to the Motorola SPI Bus - The DS1620 Digital Thermometer and Thermostat provides 9-bit temperature readings which indicate the temperature of the device. SPI interface found on many Motorola processors cannot directly communicate with the 3-wire interface found on the DS1620. This article describes how to connect DS1620 to SPI bus. Rate this link
- Interfacing SPI Peripherals to the MAX7651 Processor - This document has a good description of operation of SPI interface and how to interface to it. Rate this link
Microwire
MICROWIRE is a serial interface standard defined by National Semiconductor. The MICROWIRE protocol is essentially a subset of the SPI[tm] interface, namely CPOL = 0 and CPHA = 0. This protocol is also used for example by Microchip and Fairchild in their serial EEPROMs. In many applications Microwire devices can be interface to a microcontroller SPI interface with help of some software.
SPI (Serial Peripheral Interface) and MICROWIRE are serial interface standards developed by Motorola and National Semiconductor, respectively. Most synchronous serial converters can be easily interfaced to these ports; but in some cases additional "glue" logic may be necessary.
Maxim 3-wire
The Maxim 3-wire interface is found on the DS1620 and some other ICs from Maxim The data flow to and from the DS1620 is multiplexed on only one pin (DQ) while SPI needs two separate signals (MOSI, MISO).
- App Note 085: Interfacing the DS1620 to the Motorola SPI Bus Rate this link
- App Note 501: Interfacing 3-Wire Real-Time Clocks With A Microcontroller - Dallas Semiconductor offers a variety of serial Real Time Clocks (RTCs). A number of these use a 3-wire interface to communicat with a microprocessor. This application note is intended to help customers understand the basics of the 3-wire interface. Rate this link
Maxim/Dallas 1-Wire bus
1-Wire?? is a simple control network system developed by Dallas/Maxim. It allows one signal wire to carry both operating power and signal. 1-Wire?? devices aim to lower system cost and simplify design with an interface protocol that supplies control, signaling, and power over a single-wire connection. One wire is enough when ground is provided on some means. Usually the network is built using a wire pair where one wire caries the signal+power and the other wire is ground. The system is quite sensitive to the right timing to operate well.
A variety of identification, sensor, control, and memory functions are available with this interface. Those chips are available in traditional IC packages, ultra-small CSPs, and stainless-steel-clad iButtons??.
- App Note 158: 1-Wire Tagging with XML - This document will present a 1-Wire?? Tag format in XML that describes the associations, groupings, and sensing operations. The 1-Wire Tag can be thought of as data that can reside in a traditional database, a file on a hard drive, or even in the memory of a 1-Wire device. The data indicates the purposes of the 1-Wire device(s), their locations, and specific software classes to service and control them. By carrying the 1-Wire Tag with a cluster of 1-Wire devices, the cluster can be self-describing and self-configuring when presented to a new master application. Rate this link
- iButton home page Rate this link
- Maxim App Note 191: DS2890 and Fluorescent Lighting Control - The 1-Wire bus provides the multidrop-networking scheme which can be used for lighting control systems. This document describes an example lighting control system based on a 1-Wire network with DS2890 digital potentiometers. Rate this link
- Maxim/Dallas 1-Wire?? devices Rate this link
- SIMAT iButton 1-Wire Hub - The HUB is designed around the DS2409 microlan coupler chip, this is basically a software controlled switch that has two switchable 1-wire outputs (main and aux) these outputs can be controlled using three basic commands, Smart on Main, Smart on Aux and All Lines Off. Rate this link
- The 1-wire-software-development Archives - discussion mailing list archive Rate this link
Interfacing techniques and questions on them
Can I Connect a Serial A/D to My Computer's Serial Port?
The answer to this question is yes, but there are simpler ways to interface to a computer. To begin with, the computer's RS-232 port uses higher voltage levels that are incompatible with most ADC's TTL/CMOS logic. Another problem is that the computer's RS-232 serial port is asynchronous, which places a few more requirements on the communication, including some additional handshaking control lines. Also, with the RS-232 serial port, you must set both ends of the link to the same baud rate. The A/D converter's serial port is synchronous; thus, its handshaking requirements are minimal and it only requires one wire for clock and one or two wires for data.
If you are truly determined, you can bit-bang using the RS-232 port's handshake lines.
What Is Bit-Banging?
Bit-banging is a method of using general-purpose I/O lines to emulate a serial port. Microcontrollers that include serial-port modules like SPI[tm] and I2C[tm] manage all synchronization and timing signals, and this activity is transparent to the user. With bit-banging, however, each write to the port causes a single transition at the port pin. And it's up to the user, first, to provide the correct number of transitions to obtain the desired waveform and, second, to ensure that the timing requirements (particularly setup and hold times for reading and writing data) are met. Due to the overhead associated with the number of writes to the port, though the actual port speed might be quite high the actual bit-bang throughput rate is usually very slow. This technique is very inefficient from a software perspective, but it may be acceptable in some applications where the communication overhead is acceptable (for example for doing occasional controlling communication).
Related information
- Frequently Asked Questions about Data Converters - General information on data converters and information on their serial interfaces. Rate this link
- Interfacing to serial converters Rate this link
Related pages in www.epanorama.net
- Computer hardware interfacing projects page Rate this link
- Interfaces used in telecommunication and data communications Rate this link
<[email protected]>
Back to ePanorama main page ??