12.12.2012 Views

Xcell Journal: The authoritative journal for programmable ... - Xilinx

Xcell Journal: The authoritative journal for programmable ... - Xilinx

Xcell Journal: The authoritative journal for programmable ... - Xilinx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Automotive<br />

Cost<br />

Speed<br />

Network Per Node<br />

CAN Up to 1 Mbps $2<br />

LIN 20 Kbps $1<br />

weight of wiring, increasing fuel efficiency,<br />

and reducing handling time and manufacturing<br />

costs. CAN also needs a 5V supply<br />

<strong>for</strong> the bus, whereas LIN only requires 2V.<br />

Table 1 shows the relative merits of LIN<br />

versus CAN.<br />

In summary, LIN offers these benefits:<br />

• Complementary to CAN as an ultralow-cost<br />

sub-network<br />

• Self-synchronization mechanism means<br />

no quartz oscillator required<br />

• Low-cost silicon implementation using<br />

on-chip UART or SCI<br />

• Single wire + low baud rate = reduced<br />

harness cost<br />

• No protocol license fee<br />

Microcontroller Implementation<br />

<strong>The</strong>re are many ways to implement LIN in<br />

semiconductors:<br />

• Software: bit bashing<br />

• Software: UART implementation<br />

• Hardware: MCU with dedicated<br />

LIN port<br />

• Hardware: PLD<br />

Let’s look at each way and explore the<br />

benefits and pitfalls of each.<br />

Software: Bit Bashing<br />

A LIN node can be implemented in many<br />

microcontrollers (MCUs) with no additional<br />

hardware except <strong>for</strong> a physical layer<br />

driver device. It can be implemented using<br />

existing on-chip MCU resources such as<br />

timers, GPIO, and interrupts – effectively<br />

“bit bashing.”<br />

This type of implementation does have<br />

restrictions – designers must adhere to<br />

Requirements Size in Programmable Logic<br />

Crystal oscillator,<br />

two wires, 5V bus supply<br />

348 slices (FPGA)<br />

Single wire 256 slices (FPGA)<br />

40M line length or 216 macrocells (CPLD)<br />

Table 1 – CAN versus LIN<br />

strict real-time programming constraints to<br />

meet the full LIN specification. This is<br />

expensive with respect to MCU timing and<br />

on-chip resources and leaves very little<br />

bandwidth <strong>for</strong> other application code.<br />

LIN nodes based purely on “bit bashing”<br />

may also be complicated to test, particularly<br />

when integrated with existing<br />

RTOSs. With this type of implementation,<br />

it would be very difficult to achieve accurate<br />

bit timing measurement and control<br />

and may not be power efficient or practical.<br />

Software: UART Implementation<br />

LIN was originally conceived to make use<br />

of existing UARTs within standard MCUs,<br />

along with on-chip timers, GPIO, interrupts,<br />

and serial ports. This is a better way<br />

of implementing than simply “bit bashing”<br />

but may have certain limitations in designs<br />

that already use the on-chip serial port <strong>for</strong><br />

other tasks.<br />

This implementation may also burden<br />

the application code with LIN protocol<br />

requirements and will complicate the<br />

design and testability of the code. This<br />

method also needs to be complemented<br />

with GPIO functionality <strong>for</strong> error checking<br />

and synchronization purposes and<br />

requires CPU activity throughout LIN<br />

message exchange. <strong>The</strong>re<strong>for</strong>e, it is not the<br />

most power-efficient solution.<br />

Hardware: MCU<br />

with Dedicated LIN Port<br />

An MCU with dedicated LIN port may<br />

appeal to more designers, as it uses offthe-shelf<br />

verified silicon. Thus, it will not<br />

burden the software application with LIN<br />

protocol processing, as shown in the previous<br />

examples. This type of micro is well<br />

suited <strong>for</strong> CAN-to-LIN bus bridging<br />

applications where a need exists to pass<br />

data between the two networks. This<br />

implementation also tends to be less<br />

power hungry than the equivalent software<br />

solution.<br />

As with most emerging networks,<br />

however, the availability of silicon and<br />

relatively high cost may be an issue and<br />

create long lead times – so <strong>for</strong>ward planning<br />

is a must with respect to ordering<br />

devices. One of the potential downfalls of<br />

using these devices is when more than one<br />

LIN is needed. For example, in an ECU<br />

gateway, you may need to use more than<br />

one MCU – which will impact part costs,<br />

manufacturing costs, stocking costs, and<br />

PCB complexity.<br />

If your design requires something outside<br />

of the specification provided by the<br />

silicon vendor, this may also cause issues,<br />

A LIN node can be implemented in many microcontrollers<br />

(MCUs) with no additional hardware<br />

except <strong>for</strong> a physical layer driver device.<br />

as these fixed function parts allow little or<br />

no flexibility <strong>for</strong> customization. <strong>The</strong><br />

devices still require an external bus transceiver<br />

chip and a degree of real-time processing<br />

in the MCU.<br />

Distributed MCU solutions can also<br />

result in complex design and test issues<br />

associated with software-based designs;<br />

designers may need to explore all potential<br />

fault and interrupt loop states so that no<br />

strange indeterminate states occur.<br />

Exhaustive testing is costly, however, and<br />

the test vectors can take longer to write<br />

than the design code itself.<br />

94 <strong>Xcell</strong> <strong>Journal</strong> Winter 2004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!