Problems with the length of GATT Charactersitic in BLE_p2pServer_ota example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-29 4:14 AM
Hello,
here in my code I want to send the received values of the payload directly to USART2. This works fine if I send less than 20 characters. If I send more, the program chrashed.
case P2P_SERVER_UART_C_WRITE_NO_RESP_EVT:
/* USER CODE BEGIN Service1Char3_WRITE_NO_RESP_EVT */
uint16_t payload_Length = p_Notification->DataTransfered.Length; // conversion uint8 Length to uint16 payload_Length
if(HAL_UART_Transmit_DMA(&huart2, p_Notification->DataTransfered.p_Payload, payload_Length) != HAL_OK)
{
Error_Handler();
}
When I set a breakpoint and check the value of the length, a maximum value of 20 is displayed although the variable SizeUart_C = 50 (in file p2p_server.c).
Why is this the case?
What can I do to transfer more characters?
- Labels:
-
STM32WBA series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-30 1:34 AM
I would like to provide more information on this topic here.
In cubeMX i have set the length of the value to 30 and the length of the "Value length" to Variable because i also want to send less than 30 characters.
Then I checked the variable "SizeUart_C" in the file p2p_server_app.c , which has the value 30.
In my opinion, the problem must lie in this program line:
uint16_t payload_Length = p_Notification->DataTransfered.Length;
However, I cannot understand why the value of “Length” does not become > 20. If I send 19 characters, the value in "payload_Length" is 19, but if I send 22 characters or more, the value here is 20.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-15 12:42 AM
Hello @ledi001
I suggest you take a look at the chapter 8.6.9 of the AN5289. It explains how you can maximize the data throughput.
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.
