Question
How to receive a variable length data using USART and DMA?
Hello!
I'm trying to receive a varible length data in USART2 and then send by USART1, but I receive the data and then a lot of spaces or newline characters.
Also, i tried to use callbacks but the output characters are wrong. I even have read about a ring buffer to work better with DMA, but I dont understand, I'm quite new to STM32 and don't know the best way to accomplish my work. Can you help me?
#define DATA_LENGTH 1
uint8_t received_data;
while(1){
HAL_UART_Receive_DMA(&huart2, received_data, DATA_LENGTH);
HAL_UART_Transmit_DMA(&huart1, received_data, DATA_LENGTH);
}