This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Configuring LIN Communications

Overview

The LIN communications architecture supports a single master node and up to 16 slave nodes on a LIN network.

LIN nodes use message frames to exchange data. The message has two parts:

  • Frame header, generated by the Master node.

  • Frame response, which contains data generated by either Slave node or a slave task on a Master node (but not both).

Configuring Your Model

First, study, and understand the LIN addressing system. See the “Message Filtering and Validation” topic in the TMS320F2803x Piccolo Local Interconnect Network (LIN) Module, Literature Number: SPRUGE2A.

Configure the LIN node in your model as a master or slave node:

  1. Configure the Target Hardware Resources tab, as described in Configure Target Hardware Resources (Embedded Coder).

  2. In the Target Hardware Resources tab, select the Peripherals tab, and then select LIN.

  3. Set LIN mode to Master or Slave.

If the LIN node is a Master node:

  • Add a LIN Transmit block to the model. This block enables the Master to generate message headers.

  • To send data, set the ID input and Tx ID Mask input to make Tx ID Match happen on this node.

  • To receive data, place LIN Receive block in the model. Set the Rx ID Mask input to make Rx ID Match happen on this node.

For example, to configure a model with a master node that receives data from a slave node:

  • Add a LIN Transmit block and a LIN Receive block to the model.

  • In the Target Hardware Resources tab, configure the ID Slave Task Byte.

  • For the LIN Transmit block, set the ID input.

  • For the LIN Receive block, set the Rx ID Mask input so that: Rx ID Mask = ID XOR Slave Task ID Byte.

If the LIN node is a Slave node:

  • To send data, place LIN Transmit block in the model. Set the ID input to match the LIN frame header issued by the remote Master. Set Tx ID Mask to make a Tx ID Match happen on this node.

  • To receive data, place LIN Receive block in the model. Set the Rx ID Mask input to make an Rx ID Match happen on this node.

For example, to configure a model with a slave node that transmits data to a master node:

  • Add a LIN Transmit block to the model.

  • In the Target Hardware Resources tab, configure the ID byte or ID Slave Task Byte (depending on the ID filtering option).

  • In the LIN Transmit block, set the ID input and Tx ID Mask input so that: Tx ID Mask = ID XOR (ID Byte or ID Slave Task Byte).

Set the Data type and Data length values in your LIN Receive blocks to match the type and length of the transmitted data. These values enable the receive block reconstruct the data from the message frames.

Note

The LIN Transmit block inherits the data type and length from its input.