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 ?