Skip to main content
Mkuma.3
Associate
August 29, 2020
Solved

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.

  • August 29, 2020
  • 2 replies
  • 1035 views

..

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
August 29, 2020

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

Mkuma.3
Mkuma.3Author
Associate
August 29, 2020

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

Tesla DeLorean
Guru
August 29, 2020

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 VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
TDKBest answer
Super User
August 29, 2020