How to Receive STM32 UART echo command using HAL libraries?
Make Sur your GPIO Rx pin in correctly configured as Rx USART2.
I suppose, FTDI cable is corretly connected between RX TX STM32 pins and your computer.
-For testing your RX comm let use empty While(1) loop.
-Enable UART2 interrupts on CUBEMx.
-Set a breakpoint in the UART2 generated ISR.
When you enter any caracter on the computer terminal, your embedded soft should stop on break point. 
This is a way a use to check Rx connection.