I have setup some my UART on the STM with DMA , and sometimes I tranceived UART data with the HALs DMA functions (HAL_UART_Transmit_DMA
und HAL_UART_Receive_DMA
) and sometimes with the HALs timouted functions (HAL_UART_Transmit
und HAL_UART_Receive
).
So far so good, now I asked myself, if I can transmit the data with the delayed functions and receive the response with the DMA functions (since my transmitted data is so short, but the answer is rather large and I could do some other calculations until I probably will have the answer).
My question basically is, if there is any reason not to mix UART non-DMA tx'es with DMA rx'es? Or is it just stylistically bad, or maybe just fine?
HAL_UART_Transmit(&huart5, com->cmd, com->cmdSize, timeout);
HAL_UART_Receive_DMA(&huart5, rfidBuffer, com->responseSize);
//some other stuff
while(!/*check if flag in HAL_UART_RxCpltCallback was set*/);
//process received data