cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I'm using STM32F373CC and i'm trying to receive a string from uart , I am new to this controller and anyone pls suggest how to receive a string from Uart1. Thank you.

Mkuma.3
Associate
 
1 ACCEPTED SOLUTION
4 REPLIES 4

The basic procedure is identical across all STM32 and probably all mcus: after setting up the UART for proper baudrate and enabling it for receive (and setting up properly the Rx pin in GPIO) you check the RXNE but in USART_SR and if it's set, you read a bye from USART_DR.

This is described in the USART chapter in Reference Manual - read it.

JW

Thanks for your reply..

yes i am able to receive a byte and i can tx the same by to the uart like this

if(USART1->ISR & USART_ISR_RXNE)

{

 char temp = USART1->RDR;

 USART1->RDR = temp;

 while(!(USART1->ISR & USART_ISR_TC));

HAL_UART_Transmit(&huart1,&temp,sizeof(temp),100);

}

this is working..i'm trying to receive a string in the same way..can i get any example source for this...if possible.

Thank you

Confused as to the point of writing to the RDR or waiting for TC

Strings can be accumulated to a buffer one byte at a time. You'll need to determine how the input gets terminated​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..