This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can not receive more than 1 byte data UART

Hello, I am trying UART communication using STMF0 familiy and Keil 5. I could send data but can not receive more than 1 byte i response. Here is my code of IRQ handler. Debugger stops only one time to the line where I read data. What is the issue in my code?

uint8_t arrayIndex=0;
void USART1_IRQHandler(void)
{
        //Check if tramsmission complete
  if((USART1->ISR & USART_ISR_TC) == USART_ISR_TC)
  {
                switch (commandCount)
                {
                        case 0:
                        {
                                 if(send == size-1)
                                 {
                                         send=0;
                                         commandCount++;
                                         USART1->ICR |= USART_ICR_TCCF;
                                 }
                                 else
                                         {
                                /* clear transfer complete flag and fill TDR with a new char */
                                                 USART1->TDR = stringtosend[send++];
                                         }
                                break;
                        }
        }

  //Read response
  if((USART1->ISR & USART_ISR_RXNE) == USART_ISR_RXNE)
  {
    chartoreceive[arrayIndex++] = (uint8_t)(USART1->RDR); /* Receive data, clear flag */

  }



}

0