AnsweredAssumed Answered

HAL_UART_RxCpltCallback() is triggered only once

Question asked by Mrunal Ahirrao on Dec 7, 2017
Latest reply on Dec 8, 2017 by Mrunal Ahirrao

Hello all,

I am using STM32F030R8T6 and also using HAL libraries for programming. I am using two UARTs one as a debug UART1 to send various messages to PC and UART2 for communication with Bluetooth module (BT24LT). As the HAL_UART_RxCpltCallback is triggered only once so I am not able to receive whole string. I am also using STM32CubeMX. I have referred This HAL UART example. What am I missing?

I have attached usart.c which initializes UARTs  and the HAL_UART_RxCpltCallback() is as below:

 

 

//Interrupt callback routine void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { if (huart->Instance == USART2) //BT UART { len = sprintf(Txbuffer, "BT response: %s", BT_UART_RX); HAL_UART_Transmit_IT(&huart1, Txbuffer, len); //send to PC whatever received here HAL_UART_Receive_IT(&huart2, (uint8_t *) BT_UART_RX, 1); } }

 

I have used HAL_UART_Receive_IT(&huart2, (uint8_t *) BT_UART_RX, 1); in main before loop. I am also attaching the screen shot whatever received on PC.

 

please guide me and correct me.

Attachments

Outcomes