Can't receive bytes through the Nucleo MB1404 - STM32HM563ZI USART2
I've created a project for my Nucleo MB1404 - STM32HM563ZI board which uses USART2 and USART3 to send and receive data to a computer. I've just configured both UARTS in the same way with the same parameters with STM32CubeMX. The USART3 works without problems ( can send and receive data),that is the UART connected to the onboard debugging microporcessor which implements a USB virtual COM and the debugging functionallities.

The problem is with USART2. I connected a "FTDI like" device that connects and converts the USART2 lines to a virual COM through USB in the computer. I can send bytes from the nucleo board to the computer and read them in the terminal software, but when I send data from the terminal software to the board I get HAL_TIMEOUT and can't read it. If I check the state of the USART with HAL_UART_GetState(&huart2); I get HAL_UART_STATE_READY. I keep calling HAR_UART_Receive(... ) in a while for 20 seconds but it reads nothing, I only getTIMEOUT.
uint8_t ui8_aux = 0;
uint8_t ui8_buffer[5];
// try to read 1 byte
ui8_aux = HAL_UART_Receive(&huart2, &ui8_buffer, 1,1000);
if (ui8_aux==HAL_OK){
// data received!
}else if (ui8_aux==HAL_ERROR){
// ...
}else if (ui8_aux==HAL_BUSY){
// ...
}else if (ui8_aux==HAL_TIMEOUT){
// ...
}static void MX_USART2_UART_Init(void){
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart2) != HAL_OK){
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK){
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK){
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart2) != HAL_OK){
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
