AnsweredAssumed Answered

USART echo program not working

Question asked by bhardwaj.shiva on Nov 11, 2012
Latest reply on Nov 12, 2012 by Andrew Neil
Hello,

I am trying to implement a simple USART echo program but am running into communication problems between the discovery board and puTTy. When I transmit a character to the discovery board it does not respond. I have my serial adapters transmit line hooked up to a scope which is outputting an 8 bit value in accordance to the configuration of 4800 baud, 1 stop bit and no parity. However even though i can see a signal being sent to the STM i am not quite sure why it does not echo and send a character back.

 
the code I am currently executing is below

int main(void)
{
 
        RCC_Configuration();  //clock initialize for usart2
        //NVIC_Configuration();
        GPIO_Configuration();//pins 2 and 3 configurationaaa
        init_usart();
        STM_EVAL_LEDInit(LED4);
        STM_EVAL_LEDInit(LED5);

    while(1)
        {
             uint16_t Data;
             
            while(USART_GetITStatus(USART2,USART_IT_RXNE) == RESET) ;
            // STM_EVAL_LEDToggle(LED4);
            Data = USART_ReceiveData(USART2); // Collect Char
            while(USART_GetITStatus(USART2,USART_IT_TXE)== RESET); // wait for empty
               USART_SendData(USART2,Data); // defined in stm32f4xx_usart.h 
  }
}


I have even tried just putting   USART_SendData(USART2,0x61) in the main while loop, but instead of the lower case a i should receive I am seeing an 'O' character in puTTy.

Please help me I dont know where I am going wrong!!!

Outcomes