AD7124 Example on STM32 Processors, problem with the serial interface


I am trying to use the AD7124 Example on STM32 Processors. I managed to compile the code on STM32CubeIDE. 

However, when running the code on the MCU, the serial interface in the program does not work. 

The serial interface is shown, but it does not take my input. 

I tried to follow the example step by step, as it is on the AD site.

according the AD site, i need to run the following code in a while loop in my main.

  while(1) {
    // display the console menu for the AD7124 application

I do the above, and the menu is shown, but it does not take my input.

As I have debugged the code, i realised the the program is taking my input trough getchar().

the AD site mention this problem but does not provide any solutions. This is the text from the AD site.


In the following function, the 'len' parameter was found to always be '1024' for the library and build environment used to develop the example code.

int _read(int file, char *ptr, int len)

In order to support the use of getchar(), len was set to 1 before the for loop.
While this is sufficient for getchar() to work, it does not support use of other stdio.h functions such as scanf(…)


Please help me as I have little experience in programming and need this for my work. 

I am thankful for any help.

[edited by: vouria at 8:27 AM (GMT 0) on 23 Jan 2020]