2025-01-19 12:37 AM
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?