Hi,
I am working on the project as a MultiLink example.
My environment is using nRF52840DK & Softdevice 6 & SDK15.
I am trying to make multiple connections and communicate.
Previously, we only communicated with NOTIFY, but decided to use INDICATE at the same time.
This is the part I modified.
Below is the ble_lbs_c.c revision.
static void on_hvx(ble_lbs_c_t * p_ble_lbs_c, ble_evt_t const * p_ble_evt) { // Check if the event is on the link for this instance if (p_ble_lbs_c->conn_handle != p_ble_evt->evt.gattc_evt.conn_handle) { return; } // Check if this is a Button notification. if (p_ble_evt->evt.gattc_evt.params.hvx.handle == p_ble_lbs_c->peer_lbs_db.button_handle) { //if (p_ble_evt->evt.gattc_evt.params.hvx.len == 1) //jwcheon edit { ble_lbs_c_evt_t ble_lbs_c_evt; #if bINDICATE if( p_ble_evt->evt.gattc_evt.params.hvx.type == BLE_GATT_HVX_INDICATION ) { ble_lbs_c_evt.evt_type = BLE_LBS_C_EVT_BUTTON_INDICATION; //jwcheon } else { ble_lbs_c_evt.evt_type = BLE_LBS_C_EVT_BUTTON_NOTIFICATION; } #else ble_lbs_c_evt.evt_type = BLE_LBS_C_EVT_BUTTON_NOTIFICATION; //org #endif ble_lbs_c_evt.conn_handle = p_ble_lbs_c->conn_handle; ble_lbs_c_evt.params.send.data = (uint8_t *)&p_ble_evt->evt.gattc_evt.params.hvx.data[0]; ble_lbs_c_evt.params.send.data_len = p_ble_evt->evt.gattc_evt.params.hvx.len; p_ble_lbs_c->evt_handler(p_ble_lbs_c, &ble_lbs_c_evt); #if bINDICATE /* Indication ACK ��ȣ �����ִ� �κ� */ if( p_ble_evt->evt.gattc_evt.params.hvx.type == BLE_GATT_HVX_INDICATION ) { ret_code_t err_code; err_code = sd_ble_gattc_hv_confirm(p_ble_lbs_c->conn_handle, p_ble_evt->evt.gattc_evt.params.hvx.handle); if( err_code == NRF_SUCCESS ) { //NRF_LOG_INFO("NRF_SUCCESS"); } else { //NRF_LOG_INFO("Error: [%x]", err_code); } } #endif
static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool enable) { NRF_LOG_DEBUG("Configuring CCCD. CCCD Handle = %d, Connection Handle = %d", handle_cccd,conn_handle); tx_message_t * p_msg; #if bINDICATE uint16_t cccd_val = enable ? (BLE_GATT_HVX_NOTIFICATION | BLE_GATT_HVX_INDICATION) : 0; #else uint16_t cccd_val = enable ? BLE_GATT_HVX_NOTIFICATION : 0; #endif p_msg = &m_tx_buffer[m_tx_insert_index++]; m_tx_insert_index &= TX_BUFFER_MASK; p_msg->req.write_req.gattc_params.handle = handle_cccd; p_msg->req.write_req.gattc_params.len = BLE_CCCD_VALUE_LEN; p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; p_msg->req.write_req.gattc_params.offset = 0; p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); p_msg->conn_handle = conn_handle; p_msg->type = WRITE_REQ; tx_buffer_process(); return NRF_SUCCESS; }
The major modification is that when INDICATE comes in, it uses the sd_ble_gattc_hv_confirm () function.
Could it be slowed down by this part?
Or I have modified some things in sdk_config.h as well.
Modified to NRF_SDH_BLE_GAP_EVENT_LENGTH: 6 -> 320
Modified to NRF_SDH_BLE_GATT_MAX_MTU_SIZE: 23 -> 128
NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE: 1408 used as is
Do you think that the communication speed is slowed down as MTU_SIZE increases?
When you communicate with NOTIFY, even these modifications are fast.
However, this is different for INDICATE.
In the case of one, the speed is slightly slow, but it is okay.
However, as the number increases to two or three, the communication speed starts to become much slower.
Also, as the communication speed slows down, the device may be suddenly disconnected at a certain moment.
Predictably, communication packets are getting slower and pushing over, and communication seems to be disconnected.
Can you help me?
Please.