I am bothered by the fact I have to ask this question at all. It should be easily found in the documentation but I cannot find it for the life of me.
I am trying to increase the size of the MTU from the default 23. Somewhere there should be a table that shows the maximum MTU size one can use as a function of SoftDevice version (if that makes a difference) and hardware platform (nRF51822, nRF52840, etc.). There might be one but the search function in the documentation is for all practical purposes useless.
My server works fine on the nRF52840 DK if I set NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 23. But when I start changing that value I am running into errors. I don't know whether I am incorrectly implementing the mtu request on my Android client or messing up on the Nordic size by using an unsupported value or initializing the value incorrectly. So it would be nice to know what the maximum size is because the Nordic support may not yet be up to the spec defined limits.
So I did something simple. Changed NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 24 and did nothing else. The application failed on the first sd_* call after the ble_stack_init(). Note I am using SoftDevice only for BTLE functionality. There must be something fundamental that I am doing wrong here.
Here is a log
<debug> app: Main start GHS
<info> app_timer: RTC: initialized.
<debug> app: Could not set the Bluetooth Address. Error code 12289
<error> app: ERROR 12289 [Unknown error code] at E:\projects\utech\nRF5_SDK_17.0.2_d674dde\examples\bl e_peripheral\ble_app_ghs_header\main.c:2229
PC at: 0x0002FEC1
<error> app: End of error report
Good luck trying to find out what the error code 12289 is! The call giving rise to the error is
// Set device address
ble_gap_addr_t addrStruct;
addrStruct.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
memcpy(addrStruct.addr, bluetoothAddress, 6);
err_code = sd_ble_gap_addr_set(&addrStruct);
if (err_code != NRF_SUCCESS)
{
NRF_LOG_DEBUG("Could not set the Bluetooth Address. Error code %d", err_code);
APP_ERROR_CHECK(err_code);
}
Works fine with MTU set to 23. Gives the above when MTU is set to 24. Is there some memory overwrite going on that is not documented?