2019-01-22 08:25 AM
I try to use uart interrupt for communicate with hyperterminal. It seems that HAL_UART_RxCpltCallback doen't work.
I made the configuration in STM CUBEMx . It send the first burst throught interrupt routine and receive only one time the aRxBuffer.
This is the main code:
HAL_UART_Transmit_IT(&huart1, (uint8_t*)aTxBuffer, TXBUFFERSIZE);
while (UartReady != SET)
{
}
/* Reset transmission flag */
UartReady = RESET;
HAL_UART_Receive_IT(&huart1, (uint8_t *)aRxBuffer, RXBUFFERSIZE);
while (UartReady != SET)
{
}
DIR_TX_485;
HAL_UART_Transmit_IT(&huart1, (uint8_t*)aTxBuffer, TXBUFFERSIZE);
while (UartReady != SET)
{
}
/* Reset transmission flag */
UartReady = RESET;
HAL_UART_Receive_IT(&huart1, (uint8_t *)aRxBuffer, RXBUFFERSIZE);
while (UartReady != SET)
{
}
HAL_UART_Transmit_IT(&huart1, (uint8_t*)aTxBuffer, TXBUFFERSIZE);
while (UartReady != SET)
{
}
/* Reset transmission flag */
UartReady = RESET;
HAL_UART_Receive_IT(&huart1, (uint8_t *)aRxBuffer, RXBUFFERSIZE);
while (UartReady != SET)
{
}
/* Reset transmission flag */
UartReady = RESET;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
}
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
/* Set transmission flag: transfer complete */
UartReady = SET;
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
/* Set transmission flag: transfer complete */
UartReady = SET;
}