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

Device connects then disconnects immediately

This behavior only occurs when connecting to the phone using the native connection procedure, it does not disconnect when using the nRF Connect app on the phone (Android Pixel 3a). Wireshark and the packet sniffer didn't shed much light, I've played with the connection interval settings, slave latency, update count etc. when I play with the max connection interval and the MTU settings I get a hardware fault.

Parents
  • Please capture and send us a sniffer trace. 


    Also please check the disconnect reason when you receive the BLE_GAP_EVT_DISCONNECTED event

  • the code never reaches that case in the ble_evt_handler

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        ret_code_t err_code;
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("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;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GAP_EVT_DISCONNECTED:
                NRF_LOG_INFO("Disconnected");
                
                // Dequeue all keys without transmission.
                (void) buffer_dequeue(false);
    
                m_conn_handle = BLE_CONN_HANDLE_INVALID;
    

  • So you only modify the sdk_config.h ? I would assume you also modify the project setting. Please send the whole project source code so we can test here. Which SDK version are you testing with ? 

    You may want to debug and check where the device crashed. Please follow the guide here

  • Look, what would be easier is if you just sent me the HID keyboard example project that works on the nRF52811 device. I presume you have such a thing. This would enable me to port my custom code to that framework which will be vastly easier than trying to debug the issue remotely with the existing example. Please send the main.c, sdk_config.h, project file and memory map file for the example that implements the HIDS keyboard example on the nRF52811 and can successfully connect and send keyboard keys to the phone. Can you do that?

  • Isn't it what exactly the example in \examples\ble_peripheral\ble_app_hids_keyboard\pca10056e for  ? Please have a look here:\examples\ble_peripheral\ble_app_hids_keyboard\pca10056e

    Please follow the guide at "Transferring emulated project" section. 

  • Perhaps but in it's native form it doesn't fit into the 192k of flash on the nrf52811, and I had to disable and exclude from the build certain elements such as the sensor simulator. As I mentioned above, the pca10056e example that i modified to fit does exactly the same thing as my code. I'm willing to concede that the issue I'm having is related to the Taiyo Yuden hardware specifically (EYSNSNZWW) but I kind of doubt that's the case. It sure would be nice to know I'm starting with source that's been verified by the manufacturer of the SOC, in this case, Nordic. I followed all the guidelines in the transferring emulated project guide. So to answer your question, no, that's not "exactly" what the pca10056e example is for because that code doesn't fit into 192k of flash without modification. Does my request make more sense now? Let me rephrase - please send me a project that is known to work on the nrf52811 itself, not on an emulated nrf52811. Thanks!

  • Hello, can you run this down? seems a simple request, thanks.

Reply Children
No Data
Related