scanf over VCP on nucleo-C071RB
I am able to use the demo code as is to send characters to TeraTerm but when I try to use scanf to get inputs from TeraTerm, i get nothing. when i debug the code, i see that the function doesn't for user entries and just go to next line in the code.
below is my C code snippet:
/* Initialize COM1 port (115200, 8 bits (7-bit data + 1 stop bit), no parity */
BspCOMInit.BaudRate = 115200;
BspCOMInit.WordLength = COM_WORDLENGTH_8B;
BspCOMInit.StopBits = COM_STOPBITS_1;
BspCOMInit.Parity = COM_PARITY_NONE;
BspCOMInit.HwFlowCtl = COM_HWCONTROL_NONE;
if (BSP_COM_Init(COM1, &BspCOMInit) != BSP_ERROR_NONE)
{
Error_Handler();
}
/* USER CODE BEGIN BSP */
/* -- Sample board code to send message over COM1 port ---- */
printf("Welcome to STM32 world !\n\r");
/* Example code to use scanf for receiving input */
char user_input[100];
printf("Enter a message: ");
scanf("%99s", user_input); // Reads a string from COM port into user_input
printf("You entered: %s\n\r", user_input);
