2025-01-30 02:19 AM
Hi,
i am using the BLE_p2pServer_ota example with NUCLEOWBA55 and i want transmitt a 20 Byte package over USART2 with DMA in circular mode (19200 Baud). Here as an example, i send 20 bytes every second via HTerm to USART2. BLE advertising (every 2s) is working (but i am not connected to the cellphone app).
The Rx Callback function is inside p2p_server_app.c and here i want to toggle the blue LED:
/* USER CODE BEGIN FD_LOCAL_FUNCTIONS*/
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(huart->Instance == USART2) // Rx Callback for USART2
{
BSP_LED_Toggle(LED_BLUE);
}
/* USER CODE END FD_LOCAL_FUNCTIONS*/
But after several transmissions (between 50 and 150) the callback function is no longer called.
Does anyone have an idea what is going wrong?
2025-01-19 12:37 AM - last edited on 2025-01-30 06:11 AM by Andrew Neil
Duplicate - merged.
Hi,
I use the example “BLE_p2pServer_ota” with NUCLEO-WBA55 as a template for a project. Once a BLE connection is established with the mobile app, I start sending 20 bytes every 3 seconds via a hyperterminal on USART2 and transmitting it as a notification. The transmission basically works, but after a few transmissions (usually between 5 and 15 transmissions) the HAL_UART_RxCpltCallback function is no longer called. I have tried DMA in normal mode and in circular mode. In circular mode it works a bit longer.
1. in main.c i start the UART2 in DMA receive mode:
/*##-2- Put UART peripheral in reception process ###########################*/
/* Any data received will be stored in "aRxBuffer" buffer : the number max of
data received is 20 */
if (HAL_UART_Receive_DMA(&huart2, (uint8_t *)aRxBuffer, RXBUFFERSIZE) != HAL_OK)
{
//Transfer error in reception process
Error_Handler();
}
2. in Rx callback function i call the task to send a notification. (This is the same task which is used for button1 in the example)
/* USER CODE BEGIN 4 */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(huart->Instance == USART2) // Rx Callback for USART2 as soon as 20 bytes received
{
UTIL_SEQ_SetTask( 1<<CFG_TASK_SEND_NOTIF_ID, CFG_SEQ_PRIO_0);
}
}
/* USER CODE END 4 */
The task was called a few times but never longer as 15 times.
How can i solve this problem?
2025-01-30 02:26 AM
Hello @ledi7
This is not a normal behavior. Could you please try to reproduce it on a simple Code (not inside the Example).
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.
2025-01-30 04:34 AM
I have created a new project from scratch and i am using USART2 with GPDMA in non-circular and circular mode. Also using 20 byte packets with 19200 baud and everything works fine.
2025-01-30 04:58 AM
So, try to check in case the problem appears if the reception is really ended or not.
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.
2025-01-30 05:56 AM
2025-01-30 05:58 AM - edited 2025-01-30 05:59 AM
2025-01-30 06:00 AM
Yes, but now only under the account ledi7
2025-01-30 06:02 AM - edited 2025-01-30 06:12 AM
So we could merge that other thread into this, then?
It's the same question?
Now merged.