Electronic – RX vs TX operation in Software UART

digital-communicationsmicrocontrollerserialstm32uart

I am short of 1 UART in my MCU. I needed 4 but so far what I have found suitable is an MCU that has 3 UARTs in it, STM32F103. So the 4th one I will have to implement in SW.

Each of my individual UARTs are either doing RX or TX operations only. So now I have an option to implement the SW UART for ONLY RX operation or ONLY TX operation.

Which of the two should be implemented in SW, a UART which is only doing RX operation or a UART which is only doing TX operation?

Best Answer

I'm not an electronics engineer, but I would go for using the TX operation as a software UART.

For an RX operation, buffering is needed, and interrupts are needed not to miss information. This is typically handled by a hardware UART.

For a TX operation, you only need to send information, which is happening when you want it (for receiving you don't know beforehand when data will be received).See hooskworks's comment (the right term is if the call can be blocked, it's easy by a software UART).

In case the UART speeds are equal, you can use one UART both for RX and TX. Even if the speeds are not equal and you know you don't receive anything while you send, you could switch speeds meanwhile probably.