Wednesday, July 27, 2011

LIN in Nutshell /LIN Tutorial

LIN [Local Interconnect Network] is used as an in-vehicle [Automotive] communication and networking serial bus between intelligent sensors and actuators operating at 12 volts. Other auto body electronics include air conditioning systems, doors, seats, column, climate control, switch panel, intelligent wipers, and sunroof actuators. The LIN specification covers the transmission protocol [Physical Layer and the Data Link Layer of LIN], and the transmission medium. The maximum communication speed on a LIN bus is 19200 baud [a 1K termination pull-up resistor is required]. The LIN Bus is a class A protocol operating at a maximum bus speed of 19200 baud over a maximum cable length of 40 meters. LIN nodes can send/receive a full 8 byte command every 10ms (or shorter commands every 5ms). The LIN specification will also handle 2400, and 9600 baud rates, and may be used as a sub-bus [sub-network] for a CANbus interface. The LIN bus uses a Master/Slave approach, having one Master and one or more Slaves. The LIN bus does not need to resolve bus collisions because only one message is allowed on the bus at a time. The LIN message protocol is defined by:


Master, Sync break [13 bits]: used to identify the start of the frame
Master, Sync field [alternate 1-0 sequences]: used by the slave node for clock synchronization
Master, Identifier [6-bit long message ID and a 2-bit long parity field]
Master, Message ID [2, 4 or 8 data bytes]: optional message length information
Slave transmission ~[1-8 data bytes]: data bytes
Slave transmission ~[8 bit]: checksum
Additional Automotive and Vehicle Buses. The different class of vehicle buses are also described.

LIN Bus Protocol

The automotive Local Interconnect Network is a UART based networking architecture. LIN uses one Bidirectional line that represents the single-wire bus transmitter and receiver.
Source : http://www.interfacebus.com/Design_Connector_LIN_Bus.html

For more Info :

and also 

http://www.esnips.com/doc/0bbf31ee-f5a3-4e4c-a866-9fe542103836/LINOVERVIEWPRESENT
 and from wikipedia:
http://en.wikipedia.org/wiki/Local_Interconnect_Network

The Clemson Vehicular Electronics Laboratory (CVEL)

This Link Consists of the details about automotive sensors, communication protocols, communication Bus standards ,EMC and other valuable information.

& for other domain like avionics
see 

http://www.cvel.clemson.edu/

A Brief Overview of Automotive Buses

CAN (Controller Area Network)

Brief Description: Can bus is a serial bus originally developed by Robert Bosch GmbH in 1986 for in-vehicle networks in cars. CAN buses employing twisted wire pairs were specifically designed to be robust in electromagnetically noisy environments. The applications of CAN bus in automobiles include window and seat operation (low speed), engine management (high speed), brake control (high speed) and many other systems. CAN buses can also be found in other embedded control applications such as factory automation, building automation, and aerospace systems.
Maximum Data Rates: 1Mbps at 40m, 125Kbps at 500m, 50kbps at 1000m
Circuit Type: Differential
Physical Layer: Twisted Wire Pair, 9 pin D-Sub
Transmission Format: Asynchronous
Drive Voltage: High: 2.75v ~ 4.5v; Low: 0.5v ~ 2.25v; Differential: 1.5v ~ 3.0v
Network Topology: Point to Point
Standards: ISO 11898/11519
More Information: http://www.interfacebus.com/Design_Connector_CAN.html



LIN (Local Interconnect Network)

Brief Description: LIN specifications are developed by the LIN consortium. Version 1.1 was released in 1999. The current version is 2.0. A primary advantage of this bus is that it can be implemented with a single wire (using the vehicle chassis as a current return path). A small and relatively slow in-vehicle communication and networking serial bus system, LIN bus is used to integrate intelligent sensors and actuators. LIN can also communicate over a vehicle's power distribution system with a DC-LIN transceiver.
Maximum Data Rates: 19.2Kbaud at 40m
Physical Layer: Single-Wire Implementation
Transmission Format: SCI (UART) Data Format
Operating Voltage: 12v over a Single Wire
Network Topology: Single Master / Multiple Slave (Up to 16 slaves)
Standards: Enhanced ISO 9141
More Information:
http://www.interfacebus.com/Design_Connector_LIN_Bus.html
http://www.lin-subbus.org/


FlexRay

Brief Description: FlexRay is a high-speed serial communication bus for in-vehicle networks. It is an extended protocol version of byteflight. The extended FlexRay has the performance features required for active safety, such as redundant transmission channels and a fault-tolerant synchronization mechanism. Applications for FlexRay include steer-by-wire and brake-by-wire systems.
Maximum Data Rates: 500 kbps ~ 10 Mbps
Communication Modes:Time-triggered, Event-triggered
Network Topology: Single-channel topologies, Dual-channel topologies
More Information: http://www.flexray.com



MOST (Media Oriented Systems Transport)

Brief Description: MOST was originally designed by Oasis SiliconSystems AG (now SMSC) in cooperation with BMW, Becker Radio, and DaimlerChrysler for multimedia applications in the automotive environment.  It was intended to be implemented on an optical fiber, so the bit rates of this bus system are much higher than previous automotive bus technologies. Since 1997, seventeen international automotive manufacturers and more than fifty key component suppliers including automotive electrical suppliers and audio-video manufacturers have contributed to this technology. MOST buses provide an optical solution for automotive peripherals like car radios, CD and DVD players, and GPS navigation systems.
Maximum Data Rates: 23 Mbaud
Layers: All Seven Layers of the ISO/OSI Reference Model for Data Communication
Network Topology: Point to Point via a Ring Topology but Star Configurations
Other Feature: Plug and Play; 60 Channels, 15 MPEG1 Channels for user configuration
Standards: ISO 7498-1 (OSI Model)
More Information:
http://www.mostcooperation.com/home/
http://www.telos.de/most/
http://www.answers.com/Media%20Oriented%20Systems%20Transport


Source: http://www.cvel.clemson.edu/auto/auto_buses01.html

Tuesday, July 26, 2011

ADC (Successive Approximation Techinque)

Block diagram


Algorithm

The successive approximation Analog to digital converter circuit typically consists of four chief subcircuits:
  1. A sample and hold circuit to acquire the input voltage (Vin).
  2. An analog voltage comparator that compares Vin to the output of the internal DAC and outputs the result of the comparison to the successive approximation register (SAR).
  3. A successive approximation register subcircuit designed to supply an approximate digital code of Vin to the internal DAC.
  4. An internal reference DAC that supplies the comparator with an analog voltage equivalent of the digital code output of the SAR for comparison with Vin.
The successive approximation register is initialized so that the most significant bit (MSB) is equal to a digital 1. This code is fed into the DAC, which then supplies the analog equivalent of this digital code (Vref/2) into the comparator circuit for comparison with the sampled input voltage. If this analog voltage exceeds Vin the comparator causes the SAR to reset this bit; otherwise, the bit is left a 1. Then the next bit is set to 1 and the same test is done, continuing this binary search until every bit in the SAR has been tested. The resulting code is the digital approximation of the sampled input voltage and is finally output by the DAC at the end of the conversion (EOC).

Souce: http://en.wikipedia.org/wiki/Successive_approximation_ADC

For a pratical ADC Chip..See the link
http://www.esnips.com/doc/ba12463b-13e8-4d01-abcc-4293761f9521/ADC_12b_ADCS7476
for its working see page no 17

CAN in Nutshell /CAN Tutorial

CAN - a brief tutorial


The CAN bus (Controller Area Networking) was defined in the late 1980 by Bosch, initially for use in automotive applications.  It has been found to be very useful in a wide variety distributed industrial systems as it has the following characteristics:
  • Uses  a single terminated twisted pair cable
  • Is multi master
  • Maximum Signal frequency used is 1 Mbit/sec
  • Length is typically 40M at 1Mbit/sec up to 10KM at 5Kbits/sec
  • Has high reliability with extensive error checking
  • Typical maximum data rate achievable is 40KBytes/sec
  • Maximum latency of high priority message <120 µsec at 1Mbit/sec
CAN is unusual in that the entities on the network, called nodes, are not given specific addresses.  Instead, it is the messages themselves that have an identifier which also determines the messages' priority.  For this reason there is no theoretical limit to the number of nodes although in practice it is ~64.
Two specifications are in use:
  • 2.0A sometimes known as Basic or Standard CAN with 11 bit message identifiers which was originally specified to  operated at a maximum frequency of 250Kbit/sec - ISO11519.
  • 2.0B known as Full CAN or extended frame CAN with 29 bit message identifier which can be used at up to 1Mbit/sec - ISO 11898.

Nuts and Bolts

From the systems and design viewpoint the detailed management of sending and receiving CAN messages will normally be done by dedicated hardware, on or off chip, (e.g. SJA1000) but an overview of these functions will be useful in order to design, setup and control a CAN system.

Signal Characteristics

CAN may be implemented over a number of physical media so long as the drivers are open-collector and each node can hear itself and others while transmitting (this is necessary for its message priority and error handling mechanisms).  The most common media is a twisted pair 5v differential signal which will allow operations in high noise environments and with the right drivers will work even if one of the wires is open circuit. A number of transceiver chips are available the most popular probably being the Philips 82C251 as well as the TJA1040.
When running Full CAN (ISO 11898-2) at its higher speeds it is necessary to terminate the bus at both ends with 120 Ohms.  The resistors are not only there to prevent reflections but also to unload the open collector transceiver drivers. We recommend that you terminate the bus correctly in all circumstances.

                                              

Message formats

The CAN protocol uses a modified version of the Carrier Sense Multiple Access/Collision Avoidance (CSMA/CA) technique used on Ethernet.  Should two messages determine that they are both trying to send at the same time then instead of both backing off and re-trying later as is done with Ethernet, in the CAN scheme, the transmitters detect which message has the highest priority and only the lower priority message gets delayed.  This means that a high priority message is sure of getting through.
             

Data Frames

These are the normal message frames used to carry data.  They contain the following fields -- this is a simplified description as the controller takes care of the detail which is only of interest to those designing controllers (who should consult the spec)
Start of frame   (SOF)
Message Identifier  (MID)     the Lower the value the Higher the priority of the message
                 its length is either 11 or 29 bits long depending on the standard being used
Remote Transmission Request (RTR) = 0  ----- see "Remote Frames" para below for non zero value
Control field  (CONTROL)  this specifies the number of bytes of data to follow (0-8)
Data Field (DATA) length 0 to 8 bytes
CRC field  containing a fifteen bit cyclic redundancy check code
Acknowledge field  (ACK)   an empty slot which will be filled by any and every node that receives the frame
                 it does NOT say that the node you intended the data for got it, just that at least one node on the whole network got it.
End of Frame   (EOF)
The way in which message collision is avoided is that each node as it transmits its MID looks on the bus to see what everyone else is seeing.  If it is in conflict with a higher priority message identifier (one with a lower number) then the higher priority messages bit will hold the signal down (a zero bit is said to be dominant) and the lower priority node will stop transmitting. 
If you are writing diagnostic code and wish to not "exist" on the network as a node, just to spy on what is happening, then you will need to ensure that the interface you use can be set to a mode where it does not automatically set the ACK bit.  The Peak interfaces and their Explorer diagnostic package can be set into such a mode.

Remote Frames

These are frames that are used to request that a particular message be put on the network - of course a node somewhere on the network has to be set up to recognise the request, get the data and put out a Message frame. This mechanism is used in polled networks.  The fields are ....
Start of frame   (SOF)
Message Identifier  (MID)  either 11 or 29 bits long depending on the chosen mode.
Remote Transmission Request (RTR)  = 1
Control field  (CTRL)  this specifies the number of bytes of data expected to be returned (0-8).
CRC field  containing a fifteen bit cyclic redundancy check code.
Acknowledge field  (ACK)   an empty slot which will be filled by any and every node that receives the frame
                  it does NOT say that the node you intended the data for got it, just that at least one node on the whole network got it.
End of Frame   (EOF)

Error checking

CAN is a very reliable system with multiple error checks
Stuffing error  -  a transmitting node inserts a high after five consecutive low bits (and a low after five consecutive high). A receiving node that detects violation will flag a bit stuffing error.
Bit error  -  A transmitting node always reads back the message as it is sending. If it detects a different bit value on the bus than the one it sent, and the bit is not part of the arbitration field or in the acknowledgement field, an error is detected.
Checksum error - each receiving node checks CAN messages for checksum errors.
Frame error - There are certain predefined bit values that must be transmitted at certain points within any CAN Message Frame. If a receiver detects an invalid bit in one of these positions a Form Error (sometimes also known as a Format Error) will be flagged.
Acknowledgement Error - If a transmitter determines that a message has not been ACKnowledged then an ACK Error is flagged.

Source: http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm