cancel
Showing results for 
Search instead for 
Did you mean: 

How to set BLE Characteristic value length

ledi001
Associate III

Hi,

i am working with BLE_p2pServer_ota example as a template and i want to send 5 Bytes of data from the client (nRF Connect App on the cellphone) to the server (NUCLEO-WBA55). However, I am having trouble receiving more than 2 bytes.

1. I made a new characteristic in CubeMX with a value length of 5 bytes and i set the length characteristic to variable because i want to send also less then 5 bytes:

2024-11-27_12h56_33.png

 

2. I started the debugger and set a brakepoint in p2p_server_app.c:

2024-11-27_13h11_31.png

3. I checked the transmitted values in expression view:

2024-11-27_13h09_20.png

Everything seems to be fine up to this point.

But when I try to send 3, 4 or 5 bytes, nothing happens and the program does not stop at the breakpoint. It seems that the change to 5 bytes was not reflected in CubeMX.

And when I look at the function aci_gatt_add_char() in the file p2p_server.c, I find here in the 4th argument SizeUart_C which has the value 2:

 /**
   * UART_C
   */
  COPY_UART_C_UUID(uuid.Char_UUID_128);
  ret = aci_gatt_add_char(P2P_SERVER_Context.P2p_serverSvcHdle,
                          UUID_TYPE_128,
                          (Char_UUID_t *) &uuid,
                          SizeUart_C,
                          CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP,
                          ATTR_PERMISSION_NONE,
                          GATT_NOTIFY_ATTRIBUTE_WRITE,
                          0x10,
                          CHAR_VALUE_LEN_VARIABLE,
                          &(P2P_SERVER_Context.Uart_CCharHdle));

 Does the argument SizeUart_C define the length of the bytes? If so, then the CubeMX code generator generates an incorrect value here.

0 REPLIES 0