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

nRF52 strange BLE connection behavior

I'm getting strange behavior when connecting to nRF52840DK. 

Log from nRF:

<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> nrf_ble_gatt: Updating data length to 26 on connection 0x0.
<error> nrf_ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned NRF_ERROR_INVALID_PARAM.
<error> nrf_ble_gatt: sd_ble_gattc_exchange_mtu_request() returned NRF_ERROR_INVALID_PARAM.
<info> app: BLE event received. Event type = 16

Log from android nRF Connect:

D	11:24:19.146	gatt.close()
D	11:24:19.157	wait(200)
V	11:24:19.369	Connecting to E5:2B:3E:67:23:CD...
D	11:24:19.369	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D	11:24:19.979	[Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
I	11:24:19.979	[Server] Device disconnected
D	11:24:20.714	[Callback] Connection state changed with status: 133 and new state: DISCONNECTED (0)
E	11:24:20.714	Error 133 (0x85): GATT ERROR
I	11:24:20.714	Disconnected

The same code works on our custom board (nrf52832). We use custom service (I have followed your custom ble service example) but this happens regardless of whether it is initialized or not. SDK configs are the same apart from logging and clock configurations.

It seems to me that I must have modified something while adding the custom service that is causing this, but I can't find what.

I use nRF5_SDK_17.0.2_d674dde, s140_nrf52_7.2.0_softdevice for DK and s132_nrf52_7.2.0_softdevice for custom board.

We need it to work on both, the DK and the custom board, so app and firmware development can continue independently (We don't have nRF52832DK).

Parents
  • Hi, 

    As described in the API documentation for sd_ble_gattc_exchange_mtu_request(), NRF_ERROR_INVALID_PARAM is thrown when "Invalid Client RX MTU size supplied". Further, the valid Client RX MTU sizes are:

    Do you have the NRF_SDH_BLE_GATT_MAX_MTU_SIZE symbol in sdk_config.h? What is the size?

    -Amanda H.

  • Hi,

    NRF_SDH_BLE_GATT_MAX_MTU_SIZE is set to 23 (same as in your custom service tutorial).

    It looks like having J-Link RTT Viewer connected to the DK is causing this error. When RTT viewer is not connected to the DK everything works as expected.

    My current RTT configuration is:

    SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
    SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
    SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
    SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
    SEGGER_RTT_CONFIG_DEFAULT_MODE 0
    NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
    NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 1
    NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 3
    

    I'm using J-Link RTT Viewer V6.44e. Is there any known bug in this version of RTT or nRF SDK?

    Or is it just my configuration that is wrong?

Reply
  • Hi,

    NRF_SDH_BLE_GATT_MAX_MTU_SIZE is set to 23 (same as in your custom service tutorial).

    It looks like having J-Link RTT Viewer connected to the DK is causing this error. When RTT viewer is not connected to the DK everything works as expected.

    My current RTT configuration is:

    SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512
    SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
    SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
    SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
    SEGGER_RTT_CONFIG_DEFAULT_MODE 0
    NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
    NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 1
    NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 3
    

    I'm using J-Link RTT Viewer V6.44e. Is there any known bug in this version of RTT or nRF SDK?

    Or is it just my configuration that is wrong?

Children
Related