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

ble_app_uart getting stuck when connected

I was doing some works with ble_app_uart in nrf51822. I have added some modification in the main function according to my requirements. What i have to do is, read data over the ble and do some works according to the received data. Now i am facing some problem. The problem is that when i connect my app to the nrf51822 the controller stops the execution of my code and waits for the ble data as long as the device is connected. when the device is disconnected it resumes the normal execution. I have to make this device to execute my code while the device is connected to the app. How can i achieve this thing? Some times the nrf51822 is automatically restarts. Why this is happening? What is this power_manage() function doing?

Parents
  • But what i am seeing is that , it is stopping the execution of the normal code and waits as long as it is connected. I will post the snippet, can you give me any solution. below code is the event handling function

    enter code here

        static void on_ble_evt(ble_evt_t * p_ble_evt)
    {
        uint32_t                         err_code;
        
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
    						data_length=0;
    				new_data=true;
    				
    				
    				
    				break;
                
            case BLE_GAP_EVT_DISCONNECTED:										
    
    					
    					data_end=true;				//* ========== FLAG FOR NEW DATA INDICATION ============ *//
    		      new_data=false;
    																
    				 err_code = bsp_indication_set(BSP_INDICATE_IDLE);
             APP_ERROR_CHECK(err_code);
             m_conn_handle = BLE_CONN_HANDLE_INVALID;	
    						
              break;
    
            case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GATTS_EVT_SYS_ATTR_MISSING:
                // No system attributes have been stored.
                err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
                APP_ERROR_CHECK(err_code);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    }
    
Reply
  • But what i am seeing is that , it is stopping the execution of the normal code and waits as long as it is connected. I will post the snippet, can you give me any solution. below code is the event handling function

    enter code here

        static void on_ble_evt(ble_evt_t * p_ble_evt)
    {
        uint32_t                         err_code;
        
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
    						data_length=0;
    				new_data=true;
    				
    				
    				
    				break;
                
            case BLE_GAP_EVT_DISCONNECTED:										
    
    					
    					data_end=true;				//* ========== FLAG FOR NEW DATA INDICATION ============ *//
    		      new_data=false;
    																
    				 err_code = bsp_indication_set(BSP_INDICATE_IDLE);
             APP_ERROR_CHECK(err_code);
             m_conn_handle = BLE_CONN_HANDLE_INVALID;	
    						
              break;
    
            case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GATTS_EVT_SYS_ATTR_MISSING:
                // No system attributes have been stored.
                err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
                APP_ERROR_CHECK(err_code);
                break;
    
            default:
                // No implementation needed.
                break;
        }
    }
    
Children
No Data
Related