STM32WB-WBA Connection Oriented Channel – COC

Revision as of 13:43, 8 November 2023 by Registered User (→‎STM32WB-WBA - Connection Oriented Channel)

1. STM32WB-WBA - Connection Oriented Channel

A COC allows the exchange of Bluetooth® Low Energy data at L2CAP layer without GATT layer. There is no notion of client/server, only central and peripheral.
To set a COC logical link, it is necessary to establish first a Bluetooth® Low Energy link.
Over this Bluetooth® Low Energy link, one or several COC can be established.
The central or the peripheral may be COC initiator.


Bluetooth® Low Energy Protocol Stack
connectivity layers.png


1.1. General L2CAP Terminology

Bluetooth® Low Energy General L2CAP Terminology


1.2. L2CAP Connection Oriented Channel use

1.3. Bluetooth® Low Energy connection and COC establishment initiated by the central

1.3.1. On central side

  • Initiate a Bluetooth® Low Energy link: send aci_gap_create_connection
  • Wait for HCI_LE_CONNECTION_COMPLETE_EVENT
  • Initiate a CoC connection: ACI_L2CAP_COC_CONNECT
  • Wait for ACI_L2CAP_COC_CONNECT_CONFIRM_EVENT (get channel_index_list)

Range of channel_index_list for the COC initiator: from 0 to 0x1F

1.3.2. On peripheral side

  • Start advertising: send aci_gap_set_discoverable
  • Wait for HCI_LE_CONNECTION_COMPLETE_EVENT
  • Wait for ACI_L2CAP_COC_CONNECT_EVENT
  • Send ACI_L2CAP_COC_CONNECT_CONFIRM
  • In hci_command_complete_event, get Channel_number and Channel_Index_List values

Range of channel_index_list for the COC peripheral: from 0x20 to 0x3F

1.4. COC data exchange

1.4.1. On sender side

Send ACI_L2CAP_COC_TX_DATA (Channel_Index, length, data)

1.4.2. On receiver side

Reception of ACI_L2CAP_COC_RX_DATA_EVENT

1.5. Example of Bluetooth® Low Energy connection, COC establishment and data exchange

Bluetooth® Low Energy and COC link establishment


COC data exchange


1.6. Code Example

A STM32WB COC code example has been shared on STM32-Hotspot [1]
A STM32WBA COC code example is available with BLE_SerialCom application

1.7. References