2012-11-10 05:08 PM
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!!! #use-an-oscilloscope2012-11-10 09:02 PM
Please help me I dont know where I am going wrong!!!
So are we supposed to guess with absolutely NONE of the initialization code that might critically impact the functionality? If the baud timing is wrong, I'd look at the value of HSE_VALUE and how that contrasts with actuality.2012-11-11 09:34 AM
Shiva,
Please post the specific codes for configuration of USART and GPIO pins set for AF, as well as NVIC. Sometimes one small omission will not generate an build error, but render you entire project dead just the same.2012-11-12 02:19 AM
''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''
So what does that tell you? You said you have an oscilloscope...