This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE L2CAP Test with PTS

Hi, I have used nRF52840-PDK. And I want to test profile and protocol with PTS. I succeeded in GATT-based service test and GATT test with PTS.

But when I try to L2CAP test, PTS makes message and doesn't conduct a test.

The message is below.

Action: Place the IUT in connectable mode. Description: PTS requires that the IUT be in connectable mode. The PTS will attempt to establish a SLC and open an L2CAP channel. Result: Cannot create LE ACL channel

I used same firmware in nRF52840 when testing GATT-based service, GATT and L2CAP. I didn't modify the source code. I just downloaded example hex file that is in Nordic SDK. The example is 'ble_app_hrs'.

I didn't find about L2CAP example in Nordic SDK. And I didn't know what API shall I use in example source code for L2CAP test. I want to know that I need to change the PTS settings or modify the source code for L2CAP test.

My L2CAP test cases are below. TP/LE/CPU/BV-01-C TP/LE/REJ/BI-01-C TP/LE/CFC/BV-01-C TP/LE/CID/BV-02-C

Thank you.

  • I am also wondering about this. Does anyone at Nordic have any information on setting up a Unit under Test for the L2CAP and SM tests for Bluetooth Certification?

  • Hi,

    Just establishing a normal connection will establish the required L2CAP signaling channel. For the Connection Oriented Channels test, you need to establish the channels yourself. We are passing these tests internally, and I can share our general test procedures for each of the test cases you list:

    TP/LE/CPU/BV-01-C

    • Advertise and wait for connection.
    • Call sd_ble_gap_conn_param_update() with some new parameters.
    • Wait for disconnection to occur, ignoring BLE_GAP_EVT_CONN_PARAM_UPDATE, as PTS sometimes disconnect before this is triggered.

    TP/LE/REJ/BI-01-C

    • Advertise and wait for connection.
    • Wait for disconnection. (L2CAP will autonomously reject unknown commands)

    TP/LE/CFC/BV-01-C

    • Advertise and wait for connection.
    • Wait a bit and call sd_ble_l2cap_ch_setup() to setup a L2CAP data channel.
    • Wait for SDU buffer to be released and channel setup to be refused.
    • Note: In automated runs, PTS will disconnect before the reject has gone over the air.
    • Wait for disconnection.

    TP/LE/CID/BV-02-C

    • This test should not be run with current Nordic Softdevices. If it is active in the test plan, that might be a mistake. From what I can see, it requires GAP 44/1, 44/2 or 45/31, all being features for simultaneous BR/EDR and LE transports.

    For TP/LE/CFC/BV-01-C specifically, here is the initialization code we use (with replaced constants etc.):

    #define L2CAP_MTU_DEFAULT 1280
    #define TSPX_LE_PSM 0x0025
    
    static uint8_t m_sdu_data_rx[L2CAP_MTU_DEFAULT] = {0};
    ble_data_t sdu_buf_rx = { .len = sizeof(m_sdu_data_rx), .p_data = m_sdu_data_rx };
    uint16_t local_cid = BLE_L2CAP_CID_INVALID;
    
    // Connect here and get a valid connection handle
    
    ble_l2cap_ch_setup_params_t ch_setup_params = {.le_psm = TSPX_LE_PSM, .rx_mtu = L2CAP_MTU_DEFAULT, .rx_mps = BLE_L2CAP_MPS_MIN, .sdu_buf = &sdu_buf_rx);
    sd_ble_l2cap_ch_setup(m_conn_handle, &local_cid, &ch_setup_params);
    
    // Expect BLE_L2CAP_EVT_CH_SDU_BUF_RELEASED
    // Expect BLE_L2CAP_EVT_CH_SETUP_REFUSED
    // Expect BLE_GAP_EVT_DISCONNECTED
    
Related