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
  • Hello Stian,

    Thank you for your answer. Due to complexity of the code because of the previous developer, I managed to do what you said in both answer. I am not sure how I can check if the correct data is sent. Do you have any methods?

    Otherwise, If I am able to fix the receiver correctly (C#, to interpret the data), I can mark one of your answers as the correct one.

    I will let you know when I have finished it (due to limited time to work on this project it can have some delay)

Children
No Data
Related