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

Peripheral disconnected ,Disconnected, reason 40

when I use central  and Peripheral all concerned, Eight Peripheral connected to the central  。when I'll connect my phone to the central  Peripheral . Device Error  

Here's the RTT message:

<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x8.
0> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x8.
0> <info> app: MAC: 139D9604E073
0> <info> app: Peripheral connected
0> <info> app: m_conn_handle 0x8
0> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x8 (response).
0> <info> app: ATT MTU exchange completed.
0> <info> app: Ble NUS max data length set to 0xF4(244)
0> <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x8.
0> <debug> nrf_ble_gatt: max_rx_octets: 27
0> <debug> nrf_ble_gatt: max_tx_octets: 251
0> <debug> nrf_ble_gatt: max_rx_time: 328
0> <debug> nrf_ble_gatt: max_tx_time: 2120
0> <debug> app: PHY update request.
0> <info> app: Fast advertising.
0> <info> app: Peripheral disconnected
0> <info> app: Disconnected, reason 40

Thank you.!

  • Hi,

    Disconnect reason 40 in hex is 0x28, that points to;

    #define BLE_HCI_INSTANT_PASSED                         0x28       /**< Instant Passed. */

    What I suspect is the problem is that a link layer procedure is started, some of these procedures assume that a change should occur in a instant after 6 connection intervals + slave latency. If the peer/link is somehow blocked during this complete period (e.g. due to scanning and/or flash erase operations), then the instant might have passed. You could try to adjust the scanning window/interval, increase connection interval, and/or maybe try slave latency=2 for the peripheral link.

  • hi Airplane

    Thank you for your answer.   I tried to change

    #define SLAVE_LATENCY                   2      

    gap_conn_params.slave_latency     = SLAVE_LATENCY;

    #ifndef NRF_BLE_SCAN_SCAN_INTERVAL
    #define NRF_BLE_SCAN_SCAN_INTERVAL 375
    #endif

    #ifndef NRF_BLE_SCAN_SCAN_WINDOW
    #define NRF_BLE_SCAN_SCAN_WINDOW 80
    #endif

    But it doesn't help. Instead, it's more error reporting 0x8.。What else could I do?  

    0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x8.
    0> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x8.
    0> <info> app: MAC: 736AE5563478
    0> <info> app: Peripheral connected
    0> <info> app: m_conn_handle 0x8
    0> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x8 (response).
    0> <info> app: ATT MTU exchange completed.
    0> <info> app: Ble NUS max data length set to 0xF4(244)
    0> <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x8.
    0> <debug> nrf_ble_gatt: max_rx_octets: 27
    0> <debug> nrf_ble_gatt: max_tx_octets: 251
    0> <debug> nrf_ble_gatt: max_rx_time: 328
    0> <debug> nrf_ble_gatt: max_tx_time: 2120
    0> <debug> app: PHY update request.
    0> <info> app: Fast advertising.
    0> <info> app: Peripheral disconnected
    0> <info> app: Disconnected, reason 8
    0>
    0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x8.
    0> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x8.
    0> <info> app: MAC: 736AE5563478
    0> <info> app: Peripheral connected
    0> <info> app: m_conn_handle 0x8
    0> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x8 (response).
    0> <info> app: ATT MTU exchange completed.
    0> <info> app: Ble NUS max data length set to 0xF4(244)
    0> <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x8.
    0> <debug> nrf_ble_gatt: max_rx_octets: 27
    0> <debug> nrf_ble_gatt: max_tx_octets: 251
    0> <debug> nrf_ble_gatt: max_rx_time: 328
    0> <debug> nrf_ble_gatt: max_tx_time: 2120
    0> <debug> app: PHY update request.
    0> <info> app: Fast advertising.
    0> <info> app: Peripheral disconnected
    0> <info> app: Disconnected, reason 8

    0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x8.
    0> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x8.
    0> <info> app: MAC: 736AE5563478
    0> <info> app: Peripheral connected
    0> <info> app: m_conn_handle 0x8
    0> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x8 (response).
    0> <info> app: ATT MTU exchange completed.
    0> <info> app: Ble NUS max data length set to 0xF4(244)
    0> <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x8.
    0> <debug> nrf_ble_gatt: max_rx_octets: 27
    0> <debug> nrf_ble_gatt: max_tx_octets: 251
    0> <debug> nrf_ble_gatt: max_rx_time: 328
    0> <debug> nrf_ble_gatt: max_tx_time: 2120
    0> <debug> app: PHY update request.
    0> <info> app: Fast advertising.
    0> <info> app: Peripheral disconnected
    0> <info> app: Disconnected, reason 40

    Best regards.

  • Hi,

    Try increasing the connection interval, and see if that helps. If you are using the scanner module to connect, and not setting any other values when you call nrf_ble_scan_init(), then increase the value of NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL and NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL in sdk_config.h

    We have a unofficial multilink version of the ble_app_uart_c here, https://github.com/NordicPlayground/nrf52-ble-app-uart-c-multilink ,you might find that useful.

Related