I was trying USART
using a STM32F407VGT6
and CubeMX
.
I am able to send and receive data using Interrupts. But I am getting a problem which I am not able to understand:
I am using HAL_UART_Transmit_IT
to send the data.
I have enabled __HAL_UART_ENABLE_IT(&huart3,UART_IT_TC);
.
Here is my code:
int main(void)
{
HAL_Init();
MX_GPIO_Init();
MX_USART3_UART_Init();
Green_Blink(100);
Orange_Blink(100);
Blue_Blink(100);
Red_Blink(100);
HAL_Delay(100);
__HAL_UART_ENABLE_IT(&huart3,UART_IT_TC);
char buff[] = {'2','4','.','0','0'};
while (1)
{
HAL_UART_Transmit_IT(&huart3,(uint8_t*)"OK\r\n ",5);
HAL_UART_Transmit_IT(&huart3,(uint8_t*)buff,5);
HAL_UART_Transmit_IT(&huart3,(uint8_t*)"OK\r\n ",5);
HAL_UART_Transmit_IT(&huart3,(uint8_t*)buff,5);
HAL_UART_Transmit_IT(&huart3,(uint8_t*)"OK\r\n ",5);
HAL_UART_Transmit_IT(&huart3,(uint8_t*)buff,5);
HAL_Delay(1000);
Blue_Blink(100);
}
}
So I am sending this kind of data. First, I am sending OK
and then I am sending the buffer data as you can see.
But in terminal(tera term in my case) I can't see the buffer data.
I can see OK
.
I don't know why this is happening. And how to resolve it?
Any suggestions?