Specifications

3. Master Design IP LIN Bus 2.0 Reference Design
24 Cypress Semiconductor – Rev. ** October 25, 2006
from this function. If the dominant state is less than 250
µS or if the state does not become recessive for more
than 5 ms, the processor is put to sleep again. The pro-
cessor can be configured to wake up on some other
interrupt if the master must wake up on its own to com-
plete some other task. For example, if the master must
wake up upon a sleep interrupt and perform some oper-
ation, add code for this also inside the function. In this
situation, the interrupt upon which the master must wake
up also must be enabled inside the ShutDownLin func-
tion.
C. RestartLin: This function restores the processor to the
original configuration and restarts the LIN core. It has a
marked area where the user can add code to start the
resources required for the main application.
3.6.13.2 Node Configuration
Some functions are provided in the NodeConfigUtilities.c file
for carrying out node configuration.
A. ConfigureNode: Use this function to assign a frame ID
to a desired node. This function sends the master
request frame with the proper parameters, sends the
slave response frame, analyzes the slave’s response,
and returns the status.
B. ReadByIdentifier0: Use this function to read the node
information of any desired slave. This function transmits
the master request frame with the ReadById command
with ID=0, sends the slave response frame and returns
the node information such as function ID, supplier ID,
and variant in variables whose pointers are passed to
this function.
C. ReadByIdentifier1: Use this function to read the serial
number of the desired slave. This function transmits the
master request frame with the ReadById command with
ID=1, sends the slave response frame, and returns the
node serial number in the variable whose pointer is
passed to this function.
The details of the read by ID request are found in the Node
Configuration section of the LIN 2.0 specifications.
3.6.13.3 Implementation of Sporadic Frames
Sporadic frames are frames that carry a signal only if an
updated signal is available. It is possible to associate more
than one frame to the same sporadic frame slot. And if more
than one frame has an updated signal, the frame having the
highest priority is transmitted in that time slot. If none of the
frames has an updated signal, then the frame remains
silent. The time for this silent frame can be set by modifying
the DEFAULT_FRAME_TIME constant in the Signal-
Table.inc file.
Up to eight sporadic frames are supported in this design.
There is a queue variable called l_sporadic_frame_queue
which controls eight sporadic frames. Each bit of the vari-
able corresponds to one sporadic frame. If a bit is set, then it
means that the sporadic frame corresponding to that bit has
an updated signal. The setting of bits must be done by the
main program. If more than one bit is set, then the frame
corresponding to the least significant of these bits is pro-
cessed first. That is, the frame corresponding to bit 0 has
the highest priority and the frame corresponding to bit 7 has
the lowest priority. When the frame has been transmitted,
the corresponding queue bit is cleared by the LIN physical
layer.
Follow these steps to construct a sporadic frame.
1. Add the name of the Sporadic Frame table in the Sched-
ule table. Type 0 as the frame time constant. When the
l_sch_tick function comes across a frame time constant
with 0, it assumes that this is a sporadic frame and pro-
cesses the Sporadic Frame table.
2. Construct a Sporadic Frame table with all the frames to
be included in the frame.
Here is an example. Say Frame5, Frame6 and Frame7
are sporadic frames. Create a Sporadic Frame table with
these frame names and their associated frame time con-
stant. Type the frame with the highest priority first.
SporadicFrames:
dw Frame5, 15
dw Frame7, 15
dw Frame6, 15
dw 0xFFFF
In that example, Frame5 has highest priority followed by
Frame7, then Frame6. Add this Sporadic Frame table to the
Schedule table with time frame constant as 0.
_Schedule1:
Schedule1:
dw SporadicFrames,0
dw Frame1, 20
dw Frame3, 10
dw Frame2, 10
dw Frame4, 10
dw 0xFFFF
Now, in the main function, whenever the signal correspond-
ing to any of the sporadic frames is updated, set the bit cor-
responding to the frame in the queue variable. The frame
with the highest priority uses bit 0 and the frame with the
lowest priority uses bit 7 of the queue byte. In the example,
Frame5 uses bit 0 and Frame6 uses bit 1 of the
l_sporadic_frame_queue variable.
if (Frame5 signal updated)
{
// Code to update the
Frame5 buffer with the signal
l_sporadic_frame_queue |=
0x01;
}
if (Frame7 signal updated)
{
// Code to update the
Frame5 buffer with the signal
l_sporadic_frame_queue |=
0x02;
}
if (Frame6 signal updated)
{