Using the ble_app_uart example on the nRF52 PDK, I can easily send multiple packets per connection interval--if I send a long string using ble_nus_string_send(), the notification consists of multiple packets.
When I try to do the same on SDK 12.3.0 and the nRF51 PDK, it doesn't work. This is because BLE_NUS_MAX_DATA_LEN is 20 in SDK 12.3.0, and in SDK 13.0, it's 155. As far as I understand it, this is either a driver or softdevice limitation, not a hardware limitation.
I see that for SDK, BLE_NUS_MAX_DATA_LEN is defined so:
#define BLE_NUS_MAX_DATA_LEN (NRF_BLE_GATT_MAX_MTU_SIZE - OPCODE_LENGTH - HANDLE_LENGTH)
NRF_BLE_GATT_MAX_MTU_SIZE is defined in sdk_config.h, and OPCODE_LENGTH and HANDLE_LENGTH are defined in ble_nus.h
For SDK12.3.0, the definition is thus:
#define BLE_NUS_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3)
and GATT_MTU_SIZE_DEFAULT is defined in ble_gatt.h (one of the headers for the softdevice).
So I have two questions:
-
Am I correct in saying that the number of packets per notification is a software issue, and not a hardware one?
-
Is there an easy way to backport the multiple-packet notification functionality for nRF51 chips? Is it as simple as redefining BLE_NUS_MAX_DATA_LEN?