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

Send 16 bits instead of 8 bits over BLE

Hello,

I'd like to send 16 bits data over ble instead of 8 bits

gatts_value.offset = 0;
gatts_value.len = len;
gatts_value.p_value = data;

err_code = sd_ble_gatts_value_set(conn_handle, value_handle, &gatts_value);

for len I set the value to 2 and cast the 16 bits to 8 bits by (uint8_t*)data.

Unfortunately I get this error:

APP ERROR: 12, line: 105, file: src/bluetooth/base_service.c

EDIT: line 105 is err_code = sd_ble_gatts_value_set(conn_handle, value_handle, &gatts_value);

Please help me.

Thank you in advance

~Taz

Parents Reply
  • Hi Stian,

    Thank you for your help and time. Unfortunately, your solution doesn't work. I'm not getting any errors, but all I am receiving is value 44. Explanation of what I mean: I have an uint16_t value in my embedded software set to constant 300 (for test). I have split it into two bytes (as mentioned above) and sending it like you told me to. I'm receiving 44 (not 300) so it's basically either staying on uint8_t or doesn't send a part of the array! ... I'm out of ideas :'(

Children
No Data
Related