Associate
January 29, 2019
Question
STM32L432-KC Not possible to receive data from the computer using USART
- January 29, 2019
- 4 replies
- 1418 views
Hi all,
I am trying to use the virtual COM port in the STM32L432KC Nucleo to send and receive data from the PC using UART. I have managed to transmit data to the computer succesfully but when I try to receive data, then it doesn't work. I am trying with a simple program and I have used STM32CubeMX to generate the code. I have set it as follows:
- USART2 (baud rate 115200)
- Enabled USART2 global interrupt
- USART2_RX and USART2_TX added (Circular mode, Increment Address Memory)
The code is the following:
HAL_UART_Receive_DMA(&huart2, rxData, 11);
while (1)
{
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_3);
HAL_Delay(200);
}And in the Rx complete callback function I am transmiting the data received:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Transmit(&huart2, rxData, 11, 10);
}I have executed it in debug mode and watched the rx buffer but it doesn't receive anything.
