cancel
Showing results for 
Search instead for 
Did you mean: 

Generated code from STM32CubeIDE cannot use getchar() to get a charater from HyperTerminal

Good B
Associate II

Hi

I generated code from STM32CubeIDE.

I cannot use getchar() to get a charater from HyperTerminal.

But I tied to use USART1->RDR. It can get a character as code below.

char ReceiveAByteUART1 = '\0';

printf("\fHardware: STM32L4 Discovery kit IoT node (B-L475E-IOT01A)r\n>");

fflush(stdout);

if(USART1->ISR & USART_ISR_RXNE) //Bit 5 RXNE: Read data register not empty

{

  ReceiveAByteUART1 = getchar();

  putchar(ReceiveAByteUART1); // Display a character.

  fflush(stdout);

}

But I can use above code on Keil uVision5.

Could you help me to solve this problem?

Thank you

0 REPLIES 0