nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs

BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES event is coming when when remote device sends l2cap connection request

I am using Nordic Serialisation library, with a nrf52480 chip as connectivity chip and a m4 arm core custom board as Application chip. I am able to establish gap connection from Remote device. But when remote device send request to connect to l2cap channel (with PSM value 129, just for experimentation purpose, I set this value), I am getting BLE Event BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES from connecticity chip. There is no L2cap request event or anything. .I am directly getting this event. I mean, 

BLE_L2CAP_EVT_CH_SETUP_REFUSED event with status as BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES.
I have set the l2cap connection configuration as below:
	ble_cfg_t ble_cfg;
	ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG; /* = 1 */
	ble_cfg.conn_cfg.params.l2cap_conn_cfg.ch_count = 1;	
	ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_mps = 67;
	ble_cfg.conn_cfg.params.l2cap_conn_cfg.tx_mps = 67;
	ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = 4;
	ble_cfg.conn_cfg.params.l2cap_conn_cfg.tx_queue_size = 4;
	err_code = sd_ble_cfg_set(BLE_CONN_CFG_L2CAP, &ble_cfg, NULL);
Parents
  • Hi,

    I am not sure what the problem is here, I assume  you only have one link established.

    If you haven't already I suggest to take a look at the nRF5 SDK example that use L2CAP:
    \examples\ble_peripheral\experimental\ble_app_ots
    \examples\ble_central\experimental\ble_app_ots_c

    You may for instance use one of those examples as peer during testing also. 

    Also double check there are no error does returned by for instance sd_ble_cfg_set() or other softevice api calls.

    If you still have problems, then an on-air sniffer log could be useful. For instance check out nRF sniffer for BLE.

    Best regards,
    Kenneth

  • \examples\ble_peripheral\experimental\ble_app_ots

    I have tried this standalone (ie, without serialisation). I am able to get BLE_L2CAP_EVT_CH_SETUP_REQUEST properly.

    And I tried runnning the HRS example from sdk, standalone(ie, without serialization), with some modification to configure l2cap, that time also I am able to get the BLE_L2CAP_EVT_CH_SETUP_REQUEST properly. 

    But when i try the HRS example via serialisation, with similar l2cap  config changes which i did for standalone hrs, I am getting the BLE_L2CAP_EVT_CH_SETUP_REFUSED event, with BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES

    I tried the HRS example in nordic pc-ble-driver (with similar changes for setting l2cap configuration) from an Ubuntu systems, there also I am getting the same _NO_RESOURCES error.
    So I am thinking whether the issue is coming only due to Serialisation..
    1) Do I need to do any configuration on connectivity chip, while compilation itself, for using l2cap channels? ( I mean, I am already calling the sd_ble_cfg_set() from Application chip, before enabling the sd, for setting l2cap configuration. Apart from this for this particular l2cap to work, do i need to do any static configuration on connectivity chip side?)
    2) What all the possible cases for BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES error to come?
Reply
  • \examples\ble_peripheral\experimental\ble_app_ots

    I have tried this standalone (ie, without serialisation). I am able to get BLE_L2CAP_EVT_CH_SETUP_REQUEST properly.

    And I tried runnning the HRS example from sdk, standalone(ie, without serialization), with some modification to configure l2cap, that time also I am able to get the BLE_L2CAP_EVT_CH_SETUP_REQUEST properly. 

    But when i try the HRS example via serialisation, with similar l2cap  config changes which i did for standalone hrs, I am getting the BLE_L2CAP_EVT_CH_SETUP_REFUSED event, with BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES

    I tried the HRS example in nordic pc-ble-driver (with similar changes for setting l2cap configuration) from an Ubuntu systems, there also I am getting the same _NO_RESOURCES error.
    So I am thinking whether the issue is coming only due to Serialisation..
    1) Do I need to do any configuration on connectivity chip, while compilation itself, for using l2cap channels? ( I mean, I am already calling the sd_ble_cfg_set() from Application chip, before enabling the sd, for setting l2cap configuration. Apart from this for this particular l2cap to work, do i need to do any static configuration on connectivity chip side?)
    2) What all the possible cases for BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES error to come?
Children
  • I have learned that we return BLE_L2CAP_CH_STATUS_CODE_NO_RESOURCES in only one case: when peer sends us valid L2CAP_LE_CREDIT_BASED_CONN_REQUEST packet and SD cannot allocate l2cap channel for it.

    From your code it seems you do call sd_ble_cfg_set(BLE_CONN_CFG_L2CAP) with l2cap_conn_cfg.ch_count = 1 that should set aside one allocable channel, so first l2cap connection should be successful.

    One thing to check, do you connect BLE link with your configured APP_BLE_CONN_CFG_TAG; /* = 1 */ (note, that default cfg tag is 0).

    I'm not sure about serialization, but it seems to me that problem may be in serialization and not in SD itself.

  • One thing to check, do you connect BLE link with your configured APP_BLE_CONN_CFG_TAG; /* = 1 */ (note, that default cfg tag is 0).

    I have tried this, using the default configuration. But still the same issue is there

    Could this  _NO_RESOURCES error due to any memory issue on the connectivity chip?

    I mean, it is trying to allocate something but memory is not available. Could that be a possibility

Related