Specifications
October 25, 2006 Cypress Semiconductor – Rev. ** 37
LIN Bus 2.0 Reference Design 4. Slave Design IP
4.6.6 Frame Definition
You now define the frames. There are two tables in this file.
One is the MESSAGE_ID_TABLE and the other is the
ID_TABLE. Type the message ID list in the MESSAGE_ID
table. Type these three messages in sequence:
MESSAGE_ID_TABLE:
dw 0x1001
dw 0x1002
dw 0x1003
After updating the MESSAGE_ID_TABLE, open the NodeIn-
formation.inc file and update the MESSAGE_COUNT con-
stant with the number of entries in the MESSAGE_ID table.
You must type the frame details in the same sequence in the
ID_TABLE. There are four entries for each frame in the
ID_TABLE.
Protected ID: This entry is for the protected ID for the partic-
ular frame. In LIN 2.0 slaves, the protected ID is allocated by
the master during node configuration. So when creating the
project, this should be left as 0xFF.
Data Direction: This entry indicates the direction of the data
flow. MASTER_TO_SLAVE indicates that the slave has to
receive data from the master and SLAVE_TO_MASTER
indicates that the slave has to transmit a response to the
master. This entry also is used to indicate if the frame is
event triggered. In case of event-triggered frames, the entry
is SLAVE_TO_MASTER | EVENT_TRIGGERED. This indi-
cates that the data direction is from slave to master and the
frame is also an event-triggered frame.
Buffer Pointer: This entry is the pointer to the buffer for this
frame that is reserved in RAM. Just enter the name of the
buffer allocated for that frame in this entry. The compiler will
translate this to the RAM address and create the table.
Data Count: This entry indicates the length of data carried
by this frame.
The ID_TABLE for this example is listed here:
ID_TABLE:
_Frame1:
Frame1:
db 0xFF
db MASTER_TO_SLAVE
db BufferFrame1
db 8
_Frame2:
Frame2:
db 0xFF
db SLAVE_TO_MASTER
db BufferFrame2
db 2
_Frame3:
Frame3:
db 0xFF
db SLAVE_TO_MASTER
db BufferFrame3
db 1
You fill the remaining records of the ID table with 0xFF. The
ID table holds 16 records. In our example, three of them are
filled. So fill the remaining 13 records with four entries of
0xFF.
db 0xFF, 0xFF, 0xFF, 0xFF
4.6.7 Response_Error Bit Definition
You now define the response error bit mask. The mask is
defined according to the bit number that carries the
response error bit. In the example, bit 7 carries the response
error bit. So the mask is 0x80. This mask is defined in both
the Lin20Slave.inc and Lin20Slave.h files. Using this feature
is explained ahead in Adding the Main Application on
page 37.
4.6.8 Node Information
The details of the node are configured in the NodeInforma-
tion.inc file. Modify the constants for the supplier ID, function
ID, variant and the node serial number according to the
node’s specifications. For example, review the Node CPM in
section 5, Example Project for Slave 1 (CPM) on page 52.
The Manufacturer’s ID is 0x1234
The Function ID is 0x2345
The Variant is 0x00
The corresponding constants for these parameters in
NodeInformation.inc is:
SUPPLIER_ID_MSB: equ 0x12; Manufacturer's
Id MSB
SUPPLIER_ID_LSB: equ 0x34; Manufacturer's
Id LSB
FUNCTION_ID_MSB: equ 0x23; Product Id MSB
FUNCTION_ID_LSB: equ 0x45; Product Id LSB
VARIANT: equ 0x00; Variant
Then modify the serial number constants to match the 4-
byte serial number of the node. For a serial number of
0xAA597142, the constants for the serial number are:
SERIAL3: equ 0xAA; MSB of Serial
Number
SERIAL2: equ 0x59
SERIAL1: equ 0x71
SERIAL0: equ 0x42; LSB of Serial
Number
Also modify the message count parameter with the number
of messages supported by the slave. As described in the
LDF, the node CPM supports three frames, so the constant
for the message count is:
MESSAGE_COUNT: equ 0x03; Number of
messages supported by the Node
4.6.9 Adding the Main Application
Now the LIN 2.0 slave node is configured and you can add
the main application. Follow the normal procedure of build-