Open In App

Logical Link Control and Adaptation Protocol (L2CAP)

Improve
Improve
Like Article
Like
Save
Share
Report

The Logical Link Control and Adaptation Protocol (L2CAP) is a layer in the Bluetooth stack that provides crucial services for communication between Bluetooth devices. L2CAP offers segmentation and reassembly services for large packets to be transmitted across Bluetooth links and also allows for the multiplexing of higher-layer protocols and services. 

Functions of  L2CAP Layer

  1. It accepts packets of up to 64 kB from upper layers and breaks them down into smaller frames for transmission. These frames are then reassembled into packets again at the receiving end.
  2. L2CAP manages the multiplexing and demultiplexing of multiple packet sources. Once a packet has been reassembled, the L2CAP layer determines which upper-layer protocol it should be passed to, such as RF communication or telephony.
  3. L2CAP also handles quality of service requirements, both during link establishment and normal operation. This includes negotiating maximum payload size to prevent large-packet devices from overwhelming small-packet devices. This is important because not all devices can handle the maximum packet size of 64 kB. The L2CAP layer corresponds with the 802 Data Link Layer which is typically responsible for transmission, framing, and error control over a particular link. As such, L2CAP overlaps the link controller task and the control end of the baseband, including error checking and correction.
Data Packet Frame

Data Packet Frame

 

In the L2CAP protocol, there are three specific fields that are used to transfer data:

  • The Length field is a 16-bit field that defines the size of the data, in bytes, coming from the upper layers.
  • The Channel ID (CID) field is a 16-bit field that serves as a unique identifier for the virtual channel created at this level.
  • The Data field is where the actual payload is placed. The maximum size of the data in this field is 65535 bytes.

The Logical Link Control and Adaptation Protocol (L2CAP) is responsible for taking data from the higher layers of the Bluetooth stack as well as from applications and sending it over to the lower layers of the stack. L2CAP does this by passing packets either to the Host Controller Interface (HCI) or, in a hostless system, directly to the Link Manager (LM). The position of L2CAP in the Bluetooth stack can be visualized with a diagram that shows the cases with and without an HCI. It is important to note that L2CAP only transfers data, not audio. This is because L2CAP works on the data link layer of the Bluetooth stack, which is responsible for managing the transmission of data packets and ensuring that they are properly organized and routed to their intended destination.

L2CAP's position in the Bluetooth protocol stack

L2CAP’s position in the Bluetooth protocol stack

The Logical Link Control and Adaptation Protocol (L2CAP) has a variety of functions that contribute to efficient communication between Bluetooth devices. Some of these functions include:

  1. Multiplexing between different higher-layer protocols, allows them to share lower-layer links. This allows multiple protocols to use the same link simultaneously, improving overall communication efficiency.
  2. Segmentation and reassembly allow for the transfer of larger packets than lower layers can support. L2CAP breaks these large packets into smaller segments and adds extra information to define the location of the segments in the original packet. The L2CAP segments the packet at the source and reassembles them at the destination.
  3. Group management, which allows for one-way transmission to a group of other Bluetooth devices. This allows for efficient communication between multiple devices simultaneously.
  4. Quality of service management for higher protocols ensures that the communication between devices meets the required quality standards.

To ensure reliable end-to-end data transfer, L2CAP relies on ACL connections. A separate control function must set up these connections when they are required by L2CAP and close them down when they are no longer needed. L2CAP also relies on the quality of service provided by these ACL connections to meet the quality of service negotiated with higher layers. These functions work together to ensure that communication between Bluetooth devices is efficient, reliable, and meets the necessary quality standards.


Last Updated : 16 Feb, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads