Exploring LIN Protocol Part 4: Understanding Message Types and Scheduling
Tags: automation, lin, beginners, career
Published: 2023-10-13 05:10:17

Hello Readers, 👋😍
My name is Aravind B N, and I work at "Luxoft India" as a Junar Software Developer. Luxoft has given me several opportunity to work on various projects, which has inspired me to discuss the important processes involved in developing a LIN (Local Interconnect Network) protocol in Master-Slave Process [part 3](https://dev.to/arvind_b_n_luxoft/understanding-lin-communication-master-slave-process-75h). This is part 4 of the LIN protocol. Here we will discuss the Message type in-detail.

**Scheduling**

In a cluster, all communication is controlled by the master. Thus this node has an established sending scheme that is planned by the system designer and is described in the LDF. This makes communication to become predictable since there is a fixed time sequence.

```
Schedule_tables {
 ScheduleTable_1 {
    RX_LIN_MSG3 delay 10 ms ;
    RX_LIN_MSG2 delay 7000 ms ;
    RX_LIN_MSG1 delay 600 ms ;
    RX_LIN_MSG delay 1000 ms ;
    TX_LIN_MSG4 delay 10 ms ;
    TX_LIN_MSG3 delay 10 ms ;
    TX_LIN_MSG2 delay 10 ms ;
    TX_LIN_MSG delay 1000 ms ;
    TX_LIN_MSG1 delay 500 ms ;
  }
 ScheduleTable_2 {
    TX_LIN_MSG_04_2 delay 500 ms ;
    TX_LIN_MSG_03_1 delay 1000 ms ;
    TX_LIN_MSG_2 delay 500 ms ;
    TX_LIN_MSG_1 delay 1000 ms ;
  }
}

```
- here ScheduleTable_1 & ScheduleTable_2 both schedulers have collection of Messages alone with delay value.

**Minislots & Slots**

A Schedule is organized into Slots, which can be furnished for transmission of 1 frame every. The size of the slots is described by way of so-known as minislots. A minislot is the cycle with which the Master Task strategies the agenda. The duration of the minislots forms the time base for the continuing communication.

**Jitter**

There is a jitter cost involved when calculating a slot's dimensions. This is the actual amount of time that separates the slot's true beginning from its nominal commencement. The remainder of the time period must be delayed to the next available slot if a body does not completely fill the current one. The IFS designates this timeframe.

**Time Reserve**

No collisions can happen during communication if the system designer accurately computes the timing conditions for all frames. Each slot needs to be big enough to ensure that the associated frame will be transmitted. The nodes receive up to 40 % more time reserve for message transmission because less expensive & less powerful processors are frequently utilised.

```
Nodes {
  Master: MyECU, 5 ms, 0.1 ms ; 
  Slaves: Slave ;
}
```

- Here "0.1 ms" is Jitter master, "5 ms" Timer base master.

**Message Types**

1. Unconditional Frame
2. Sporadic Frame 
3. Event Triggered Frame 
4. Diagnostic Frame.

 1.Unconditional Frame

- Unique assignment between a frame header and a frame response.
- Unique assignment between an unconditional frame and a frame slot
- A response is always transmitted.
- ID: 0-59

_The Standard Frame_
Typically, valuable facts are transmitted via the unconditional frame. This message type is equivalent to the common frame, which is used without any further restrictions. All different sorts are best used in specific situations.

_No Collisions_
No collisions can happen during operation since an unconditional body has a special courting between the heading and reaction. Additionally, only one node may use a slot at a time. Consequently, unconditional frames are perfect for periodic records transmission, since the time at which a message appears on the bus is predictable.

_Unique Response_
A header and a response are both parts of the unconditional body. The header is sent onto the bus as a request by the grab. A designated slave provides the solution after that. Based on the identifier (ID), a Slave Task recognises whether or not it wants to send a response. The identifier and send the reaction can also be used to address the slave mission of the grip. The LDF describes which node sends the relevant reaction and in what manner.

 2.Event Triggered Frame 

- Unique assignment between a frame header and generally several "responses" of defined unconditional frames of identical length and the same checksum model.
- First data byte in the response is reserved for the PID.
- Unique assignment between event triggered frame and frame slot.
- Frame header is always sent in the relevant frame slot.
- Event-triggered transmission of the frame response by the relevant slave task.
- Collisions are resolved by the master.
- ID: 0-59.

_Functionality_
The assigned slaves may add their unique responses to the header that the grab transmits along with an event-prompted body's identity. Only one response can be delivered after the header, hence an additional PID is included in the first records byte. As a result, it is possible to determine which node submitted its reaction to the bus. All capability answers have the same number of data bytes to ensure that the length of an event triggered frame is unquestionably determined.

_Feature_
The message type was used to convey event-driven data that needs to be sent as soon as possible by a node. An occasion caused frame is basically the same as a standardised Unconditional Frame. The contrast is the fact that more than one slave may respond to a heading from the grab.

_Risk of Collisions_
Collisions are conceivable because many nodes may respond to an event-triggered frame. The master uses a Collision Resolving Schedule to resolve these collisions. This is a unique sending technique in which slave responses are polled once more and treated as standard unconditional frames. After detecting a collision, the master begins processing the Collision Resolving Schedule before returning to the originally departed Schedule. This ensures that any open responses that must be sent are sent.

3.Sporadic Frame 

- Unique assignment between a frame slot and generally several defined unconditional frames whose "responses" are transmitted by the master.
- Event-triggered transmission of the frame response by the master.
- ID: 0-59.
_Functionality_
The master employs erratic frames to transport infrequently utilised facts, that is, sporadic records. This body is an Unconditional Frame that shares a slot with other unconditional frames. The master sends out random frames as desired. If there is no desire to ship them, the corresponding slot is empty. For the master, the sporadic frame is primarily an Event Triggered Frame.

_Risk of Collisions_
There is a desire to send if at least one signal in the related unconditional frame has changed. When more than one slave wants to ship, there are no clashes since the master approaches the Tx requirements in successive Schedule runs. The LDF contains information about the series. It takes precedence over a given unconditional frame.

This is Fourth part of the LIN Protocol next article based on Data Protection process and Diagnostics LIN protocol alone with example.

Do let me know if you have any queries in the comments below.

Thanks for reading.