Arm Mbed OS support forum

Getchar() function on FRDM-K22F doesnt seem to receive characters


I am trying to use the getchar() function to read a character from the UART using the FRDM-K22F board and it doesn’t not seem to accept the character via the console terminal.
I am using mbed-os 5.15.
Any leads on the same would be really helpful. Thanks in advance !


I do not know a context but getchar() will read only input from default STDIO of your board. That means on those pins and if understand it correctly they are connected to OPENSDA interface and its OpenSDA debug USB connector.

I tested it (MbedOS 5.15.8 with Nucleo-F767ZI) like below and it works.

  int c = getchar();
  printf("char is %c\n", c);

BR, Jan