2024-11-27 04:36 AM
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:
2. I started the debugger and set a brakepoint in p2p_server_app.c:
3. I checked the transmitted values in expression view:
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.
2024-12-19 04:42 AM
Hello @ledi001
Yes, the SizeUart_C is the Char_Value_Length. It means the Maximum length of the characteristic value. Using STM32CubeWBA V1.5.0, STM32CubeMX V6.13.0 and STM32CubeIDE V1.17.0 I've been able to create a characteristic with the size other than 2. So, it should work fine.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.