USART Interrupt only receives and processes first string
USART1 interrupt only receives one string, processes it well and returns it back as expected. But when i issue the second string, the check USART_IT_RXNE status flag is always false. I tried to reset it right after the preceeding string is sent but all in vain. Here is my code...Am using the tiny STM32F303K8
void USART_puts(USART_TypeDef* usar_tx, volatile char* str)
{
while (*str)
{
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) {}
USART_SendData(usar_tx, *str);
str++;
}
}
void USART1_IRQHandler(void)
{
if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
static int cnt = 0;
char ch = USART_ReceiveData(USART1);
if (ch != '\r')
{
rcvd_str[cnt++] = ch;
}
else
{
rcvd_str[cnt] = '\r';
cnt = 0;
USART_puts(USART1, rcvd_str);
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
}
}
}What on earth am i doing wrong or missing.
