Part 1 of this series covered basics and LIN master nodes.
Bit-banged LIN slaves
As stated in the previous installment, LIN slaves can use a timer input capture channel for reception and a general purpose output pin for the transmit channel. Two Freescale LIN application notes, AN2503 and AN2599, detail how this bit-banging technique is done, with slightly different features implemented in each version. Additionally, you can find a reference design on the Freescale Website that uses an HC908QY4 device to bit-bang LIN a set of steering wheel switches with pulse-width-modulation backlighting.
Bit-banged solutions can be done on almost any MCU provided there is one timer channel and one output pin, but it is very software intensive. It can be a cost-effective alternative, but the microcontroller CPU has to process a large number of interrupts and the entire process of sending and receiving bytes must be performed in software at a bit level. This is more performance than many applications can spare to simply communicate.
ESCI LIN slaves
The next step up the performance ladder comes with the advent of the Enhanced Serial Communications Interface (ESCI) module (found on many Freescale HC908 family devices). The ESCI is specifically tailored to LIN slave applications. It has an integral arbiter module that can recover the baud rate from the LIN synchronization byte in the header, as well as greatly increased resolution on its prescaler structure, which allows it to adjust for clock frequency drift due to temperature and voltage changes.
View a full-size image
Many applications work very well with an ESCI solution, but there is one higher level of performance in the LIN slave microcontroller line. The ESCI still must handle messages on a byte level, which means that every byte of a message, whether sent or received, generates an interrupt to the microcontroller. This is also true of messages that the slave doesn't even wish to receive.
SLIC LIN slaves
To help eliminate such unwanted interrupts and fully automate the low-level LIN protocol functions to streamline interrupt service code and LIN software, Freescale has developed the Slave LIN Interface Controller (SLIC) module. This latest LIN communications peripheral device utilizes patented technology to synchronize to any LIN bus speed at any time. The result of these performance enhancements means that developers can spend more of their performance budget directly on the application and less on simple communications.
The SLIC module has powerful features such as:
True automatic frame synchronization and autobauding, which: Synchronizes to LIN traffic; eliminates preprogramming of baud rate; can autobaud up to 120 kbps for high-speed reprogrammability, and no oscillator trimming is needed.
LIN interrupt reductions of up to 83.3% (Two interrupts per standard LIN frame maximum)
Automatic LIN error checking and reporting
Interrupt service routines of less than 150 bytes possible
Automatic checksum generation/checking
There are many more advantages to the SLIC module, such as an interrupt vector handling mechanism that allows extremely efficient interrupt service routine handling to minimize time spent in the routine. Combined with the full message buffering, which is designed to reduce the number of interrupts to a maximum of two for any LIN message, the SLIC module performance is a significant improvement. The figure below shows the interrupt loading for an SLIC-based node and a UART based node.
Which solution to choose?
Every application is different and has different performance and cost targets. A great number of factors must be considered when choosing the right solution for any application. To aid in this process, Freescale benchmarked the three solutions above and the results can be found in a table in AN2633, "LIN Drivers for SLIC Module on the MC68HC908QL4". A list of application notes that can be found on the Freescale Website is given in the table below.
Conclusion
With worldwide automakers adopting the LIN and SAE J2602 standards, it is certain that LIN will continue to grow. Applications are not limited to automotive systems; LIN can also be implemented in home automation, industrial networking, and many other applications where sensors, motors, switches, and actuators need to be connected at low-cost.
Freescale's Matt Ruff has been working in applications and systems engineering for the past nine years, specializing in automotive communications. His work with CAN and LIN products and standards has resulted in a patent and numerous publications, including articles, papers, and contributions to a textbook on the LIN protocol.
References
Reference designs, application notes, and more can be found at the Freescale Semiconductor LIN Website.
Implementing Local Interconnect Network (LIN) Slave Nodes, SAE Paper Number #2002-01-1298 (Search the SAE bookstore for this paper).
|