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

How a peripheral(nRF52840, s140 v7.0.1) know the value of BLE_NUS_MAX_DATA_LEN of a central?

Hi,

Just as the title says, I want to use nRF52840 as a peripheral(s140, v7.0.1, BLE_NUS_MAX_DATA_LEN is 244) and using NUS.

And it may pair to a nRF51822(s120, BLE_NUS_MAX_DATA_LEN is 20) or recent Smart Phones(BLE_NUS_MAX_DATA_LEN is over 200).

I think it should send proper length of data according to the central's BLE_NUS_MAX_DATA_LEN value.

So, my question is how nRF52840 peripheral know the central's BLE_NUS_MAX_DATA_LEN value? 

Thank you

  • Hi

    If you take a look at for example the ble_app_uart_c project in our SDK, you can see that the BLE_NUS_MAX_DATA_LEN is negotiated as well as the MTU in the gattt_evt_handler() function. Both peripheral and central have implemented this in the gatt_evt_handler(), so that is how the NUS data length is deviced between peripheral and central.

    Best regards,

    Simon

Related