I did implement a fast transmit queue successfully for serial port printing. That works well with a development board. But in my real circuit, the TX pin is driving the LED of an opto-isolator. The result is that it still works but it inserts a faulty character after each completed DMA transfer. I found why: when the transmission completes, the tx pin go to high impedance state instead of continuing to drive a 1. So the LED is not driven and it appears like a 1 on the other side. Because the print buffer is often full, the high impedance state duration is very short, 15us. With 115200 baud it looks like a valid zero while it is just the time it takes to re-enable the UART in the interrupt. I could add a fix with a pull-up resistor, but this have serious drawback in the application context. I am looking to find a firmware way to do it. This is roughly how I am using the HAL drivers:
The HAL_UART_Init() is called before starting the main loop.
The HAL_UART_Transmit_DMA() is called when a print buffer is ready.
The HAL_UART_TxCpltCallback() is called by the DMA after transfer complete, and from it, I call immediately HAL_UART_Init() again while I set a flag to ask the main loop for checking if a new print buffer is ready.
Thank you !