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

Do not receive BLE_L2CAP_EVT_CH_TX from softdevice s140 on calling sd_ble_l2cap_ch_tx

OS: Linux Ubuntu 18.04

Compiler: Gnu ARM embedded

HW: 2 nrf52840dk boards

NRF SDK: 16.0.0

I am trying to send data using L2CAP CoC. I have looked at the ots example, and have run it ok on 2 52840 DK boards, hence the hardware setup is ok. 

I have removed all the OTS overhead and am using sd_ble_l2cap API. It successfully connects and all the expected connection callbacks are triggered. 

Image below shows the UART log of my central device (nrf52840). You can see that BLE_L2CAP_EVT_CH_SETUP is triggered with a successful connection, state is CONNECTED, cid is ok.

Image below UART log of my peripheral device (also nrf52840). You can see that BLE_L2CAP_EVT_CH_SETUP_REQUEST is triggered, post which L2CAP_EVT_CH_SETUP is triggered indicating a successful connection. 

This assures me that the hardware setup, softdevice hex file, compiler settings, build etc are all ok. 

After connection when I try to send any data from either central or peripheral side, I never get a BLE_L2CAP_EVT_CH_TX  event from the softdevice. 

Questions:

1. What else should I check ?

2. In the connection, credits from peer are 0. Does this mean that the sender cannot send any l2cap msgs ? 

   I have called sd_ble_l2cap_ch_flow_control with 10 credits but do not get BLE_L2CAP_EVT_CH_CREDIT from the softdevice. 

3. The default value of credits is 1, however the value printed is 0. I simply print the value of "p_ble_evt->evt.l2cap_evt.params.ch_setup.tx_params.credits". This should mean that credits are not issued for any tx, however in the OTS example, I have added the same debug print and communication works even when the print is 0. Why is that ?

Parents
  • Hi

    Have you looked at the debug log at all when trying to send data from either side to see if you get an error message of any sort? I'm guessing that the amount of credits you have initially are not sufficient, which is what causes nothing to happen. You can try changing the initial credits by making sd_ble_l2cap_ch_flow_control only set initial credits in LE Credit Based Connection Request, and not send LE Flow Control Credit packets. If you call sd_ble_l2cap_ch_flow_control(...,local_cid = BLE_L2CAP_CID_INVALID) before sd_ble_l2cap_ch_setup(), the credits provided by sd_ble_l2cap_ch_flow_control will be used for the newly created channel.

    Best regards,

    Simon

  • I called sd_ble_ch_flow_control with CID_INVALID and it sets credits for the peer device. So, the peer device can now send pkts successfully.

    However, I also need to set credits for the initiator. I have tried modifying the value of default credits and called sd_ble_ch_flow_control, however the initiator does not get credits. 

Reply Children
No Data
Related