Associate III
December 7, 2017
Solved
HAL_UART_RxCpltCallback() is triggered only once
- December 7, 2017
- 1 reply
- 1403 views
Posted on December 07, 2017 at 10:21
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 theHAL_UART_RxCpltCallbackis triggered only once so I am not able to receive whole string. I am also using STM32CubeMX. I have referred
https://letanphuc.net/2015/09/stm32f0-uart-tutorial-5/
. What am I missing?I have attached usart.cwhich initializes UARTs and theHAL_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 usedHAL_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.
#stm32f0