Greetings, I tried to modify the parameter "len" to anything over 1 (byte), but it just doesn't work.
As long as it's over 1 byte, the API crashes my program. err_code shown in the following picture:
Assistance needed. Thanks everyone.
Greetings, I tried to modify the parameter "len" to anything over 1 (byte), but it just doesn't work.
As long as it's over 1 byte, the API crashes my program. err_code shown in the following picture:
Assistance needed. Thanks everyone.
Do you have the code which initializes the characteristic that you are performing the HVX on? If the size of the characteristic is set statically to 1 byte, then that would be an issue.
Your error code is 0x0000000C or NRF_ERROR_DATA_SIZE. That means that you are probably trying to notify a length longer than the actual length of your characteristic. Check your call sd_ble_gatts_characteristic_add() call as shibshab said.
Thank you very much Carles, ;) could you be a bit more specific regarding what particular attribute/parameter I need to modify?
Edit:I now believe it's "attr.max_len". Can anyone tell me the max value for it? I tried to look up "BLE_GATTS_ATTR_LENS_MAX" but couldn't find it anywhere?
The maximum length of a characteristic is:
BLE_GATTS_FIX_ATTR_LEN_MAX (510) /**< Maximum length for fixed length Attribute Values. */
BLE_GATTS_VAR_ATTR_LEN_MAX (512) /**< Maximum length for variable length Attribute Values. */
depending on whether you have fixed or variable length.
But the maximum length you can notify or indicate is only a portion (the first bytes of) the total length of the characteristic. In the current s110 it is:
GATT_MTU_SIZE_DEFAULT - 3
so you can notify/indicate the first 20 bytes of any characteristic, which can be up to 510/512 bytes long