I am using STM32F4 series MCU with STM32CubeMX enviroment. I can send and receive data without problem in RS232 physical layer.
My problem is that when I use with it in RS-485 physical layer, I should know when transmission process is finished, last bit is sent from shift register and I am ready to terminate transmit function and enable receive function of RS-485 chip.
What is the flag convention of UART_Busy_Flag or related flag with this process.
Best Answer
You should use the following function:
and make sure that the UART and the DMA interrupts are enabled.
If you look into the implementation, (only a part of it):
The DMA will be started in IT mode, and there are three
HAL_UART
callbacks which will be called by the callback functions above.HAL_UART_TxCpltCallback
HAL_UART_TxHalfCpltCallback
HAL_UART_ErrorCallback
All of these have weak declaration so you have to implement them. For example: