A LIN bus consists of a Master
module and one or more Slave
modules. The Master
module contains a master task which transmits ID codes on the LIN bus.
All of the modules, including the Master,
contain a slave task. The slave tasks keep a list of IDs to which they
respond by transmitting two to eight data bytes. Together the ID and data bytes
are presented as a single LIN data message by the Server.
Another way to look at the LIN protocol is that each message, consisting
of an ID (header) code and data, is really two messages. The first
message is the ID code transmitted by the master task in the Master
module. The second message is the two to eight data bytes transmitted
by a slave task. Since the Master module also contains slave task, it
is possible for the slave task in the Master module to respond to an ID
sent by the master task in the same module.
If the is being used to emulate a LIN slave module, it
has to respond with two to eight data bytes very quickly after
an ID code appears on the LIN bus. In order to meet this timing
constraint, the data for a given ID code is stored in the LIN card and
is transmitted on the LIN bus when the appropriate ID code is
seen by the card. To accomplish this, a FT_DATA frame
containing the ID code as the header and the data bytes in the data
portion of the message is sent to the card via the Server. The
LIN card is able to store up to eight data bytes for each valid
ID code. This means that a single LIN card is able to emulate all of
the slave nodes on a LIN network.
If the is being used to emulate a LIN master module, it has to send out a series of ID codes on the LIN bus and to be able to respond to some of those ID codes with two to eight data bytes. The LIN card has been designed with both a master task and a slave task. The slave task responds to ID codes using data sent by an external program and stored on the card. The master task can be configured to transmit a list of IDs on a fixed schedule. This schedule is run on the LIN card and should not be confused with the Schedule mechanism. The LIN card can transmit an ID in response to a FT_DATA message. If the message contains only the ID code in the header, then the LIN card transmits that ID immediately. If the message contains an ID code and two to eight data bytes, the data bytes are stored on the card based on the ID code and the ID code is transmitted. It is possible to just store the data bytes and not transmit the ID code. See the LIN card documentation for the details.
protocol messages sent to SD_LIN make the process of handling the nodes on a LIN bus easier. A program can request that the read and parse an LDF that has been stored on the . Once the has read an LDF, it is able to answer queries about the the nodes, messages and signals defined in the LDF.
LIN
bit positions Signal fields are defined as starting at their LSB Byte number 0 is transmitted first |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Byte
number
|
msb | Bit offsets | lsb | |||||||
0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ||
1 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | ||
2 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | ||
3 | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | ||
4 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 | ||
5 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | ||
6 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | ||
7 | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |