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

SDK 15.2 ANCS change MTU to 185 fail , NRF_ERROR_BUSY

Help !

I use ANCS  need change ATT MTU to more , but I met an incredible thing . 

 just change NRF_SDH_BLE_GAP_DATA_LENGTH to 189 & NRF_SDH_BLE_GATT_MAX_MTU_SIZE = 185


but i get this bad issue ~~ [NRF_ERROR_BUSY] at ..\..\..\main.c:338

please HELP me ~ thank you ~  how can I fix it ~

 

SDK15.2 / nrf52810 / S112 / ble_app_ancs_c 

this is fail log ~ 

0> <info> app: Apple Notification Center Service client example started.
0> <debug> app: pm_whitelist_get returns 0 addr in whitelist and 0 irk whitelist
0> <info> app: Fast advertising
0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 185 bytes on connection 0x0.
0> <info> app: Connected.
0> <debug> nrf_ble_gatt: ATT MTU updated to 185 bytes on connection 0x0 (response).
0> <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
0> <debug> ble_db_disc: Starting discovery of service with UUID 0x1801 on connection handle 0x0.
0> <debug> app: New Bond, add the peer to the whitelist if possible
0> <debug> app: m_whitelist_peer_cnt 1, MAX_PEERS_WLIST 8
0> <debug> ble_db_disc: Found service UUID 0x1801.
0> <debug> ble_db_disc: Discovery of service with UUID 0x1801 completed with success on connection handle 0x0.
0> <debug> ble_db_disc: Starting discovery of service with UUID 0xF431 on connection handle 0x0.
0> <debug> ble_db_disc: Found service UUID 0xF431.
0> <debug> ble_db_disc: Discovery of service with UUID 0xF431 completed with success on connection handle 0x0.
0> <debug> ble_ancs_c: Database Discovery handler called with event 0x0
0> <debug> app: Apple Notification Center Service not discovered on the server.
0> <debug> nrf_ble_gatts_c: Service Changed Characteristic found.
0>
0> <debug> app: GATT Service and Service Changed characteristic found on server.
0> <debug> ble_ancs_c: Database Discovery handler called with event 0x0
0> server.
0> <info> ble_ancs_c: Enable Notification Source notifications. writing to handle: 41
0> handle: 44
0> <debug> app: Notifications Enabled.
0> <debug> app: pm_whitelist_get returns 1 addr in whitelist and 1 irk whitelist
0> <info> app: Fast advertising with Whitelist
0> <debug> app: GATTS Service client disconnected connection handle 0.
0> <info> app: Disconnected.

Turn off iPhone BT switch

Turn on iPhone BT switch

0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 185 bytes on connection 0x0.
0> <info> app: Remote Database loaded from flash.
0> <error> app: ERROR 17 [NRF_ERROR_BUSY] at ..\..\..\main.c:338
0> PC at: 0x000228F5
0> <error> app: End of error report

Parents
  • Hi,

    It looks like the app is trying to enable the Service changed indication while the MTU exchange is ongoing. Both procedures use indications and thus can't be performed in parallel. 

    Try to replace nrf_ble_gatts_c_enable_indication() in pm_evt_handler() with the code below which will attempt to re-transmitt the request if "busy" is returned. It's based on nrf_ble_ancs_c.c->ble_ancs_c_notif_source_notif_enable()

     

                        // Enable indications.
                        /*ret = nrf_ble_gatts_c_enable_indication(&m_gatts_c, true);
                        APP_ERROR_CHECK(ret);*/
    
    
                        tx_message_t   p_msg;
                        memset(&p_msg, 0, sizeof(tx_message_t));;
                        uint16_t       cccd_val = BLE_GATT_HVX_INDICATION;
    
                        p_msg.req.write_req.gattc_params.handle   = m_gatts_c.srv_changed_char.cccd_handle;
                        p_msg.req.write_req.gattc_params.len      = 2;
                        p_msg.req.write_req.gattc_params.p_value  = p_msg.req.write_req.gattc_value;
                        p_msg.req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
                        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                         = p_evt->conn_handle;
                        p_msg.type                                = WRITE_REQ;
    
    
    
                        tx_buffer_insert(&p_msg);
    
                        tx_buffer_process();

Reply
  • Hi,

    It looks like the app is trying to enable the Service changed indication while the MTU exchange is ongoing. Both procedures use indications and thus can't be performed in parallel. 

    Try to replace nrf_ble_gatts_c_enable_indication() in pm_evt_handler() with the code below which will attempt to re-transmitt the request if "busy" is returned. It's based on nrf_ble_ancs_c.c->ble_ancs_c_notif_source_notif_enable()

     

                        // Enable indications.
                        /*ret = nrf_ble_gatts_c_enable_indication(&m_gatts_c, true);
                        APP_ERROR_CHECK(ret);*/
    
    
                        tx_message_t   p_msg;
                        memset(&p_msg, 0, sizeof(tx_message_t));;
                        uint16_t       cccd_val = BLE_GATT_HVX_INDICATION;
    
                        p_msg.req.write_req.gattc_params.handle   = m_gatts_c.srv_changed_char.cccd_handle;
                        p_msg.req.write_req.gattc_params.len      = 2;
                        p_msg.req.write_req.gattc_params.p_value  = p_msg.req.write_req.gattc_value;
                        p_msg.req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
                        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                         = p_evt->conn_handle;
                        p_msg.type                                = WRITE_REQ;
    
    
    
                        tx_buffer_insert(&p_msg);
    
                        tx_buffer_process();

Children
Related