2025-08-21 7:45 PM
Hi Guys
I am doing a project and I notice that if I unplug the UART cable(FTDI) and then connect it again, there is a chance that there would be mysterious bytes received from RDR.
What is more interesting is that the mysterious bytes are actually the messages that was sent out to UART Tx.
During the testing, I am not using any UART serial monitoring tool like Putty or what's so ever, so there should not be any inputs to the UART Rx. But it just happened, not often, but if I repeat disconnect and reconnect dozens of times, then something from UART Tx got into the UART Rx buffer.
I have confirmed that those mysterious bytes are read out from RDR.
Has any one know what's happening ?
Thanks.
Solved! Go to Solution.
2025-08-26 4:59 PM - edited 2025-08-26 5:29 PM
But unplugging the USB doesn't disconnect the device from the STM32. The RX pin is still connected to whatever is on the adapter board, along with TX and GND.
As its power starts to drop, it is still trying to drive that pin but VDD isn't 3.3 V anymore. That's what you're seeing. Eventually, the chip powers off and the pin goes high impedance.
2025-08-21 8:01 PM
Is RX floating? If so, nearby pins will influence it, such as TX.
If it's not floating, then there is probably another explanation. Code bug, misinterpretation, etc.
2025-08-21 10:56 PM
Blue is Rx and Yello is Tx. There seems no pull up on Rx, so it drops when UART cable is disconnected.
2025-08-22 12:22 AM
You are probably talking about a Windows host here.
Consider that the host USB drivers are not perfect either. Far from it, actually.
2025-08-22 1:33 AM
Hello,
The minimum thing to do is to activate internal pull-up resistor on the Rx line of the STM32, to avoid it floating in case nothing is connected.
2025-08-22 3:08 PM
UART uses push-pull on the TX pins. So yeah, if you disconnect the USB to the FTDI, it can't pull the Rx pin to high.
2025-08-25 7:03 PM
Hi Mike
I tried to use the internal pull up and got below behaviour. It seems still a voltage drop for a short period of time when I disconnect uart cable. Is it normal ? And I can see vertical noise that is synchronized with Tx timing, which is probably due to coupling ?
2025-08-26 1:43 AM
Hello,
>> I tried to use the internal pull up and got below behavior. It seems still a voltage drop for a short period of time when I disconnect UART cable. Is it normal ?
Can't tell.
I have never analyzed plug/unplug events on a serial line.
I'm not sure what I'm seeing on the scope, what kind of event it is, at what time stamp, and where the probe is connected.
>> I disconnect UART cable
Is it a RX+GND disconnection, or is it just the RX wire ?
>> And I can see vertical noise that is synchronized with Tx timing, which is probably due to coupling ?
Probably.
2025-08-26 4:32 AM
Something isn't right here. If you disconnect RX, and the internal pullup is enabled, the level will not drop.
2025-08-26 1:12 PM - edited 2025-08-26 1:14 PM
What connector does the USB-to-UART cable have on the STM32 end? Is it one with the tip.ring/sleeve audio style connector (FTDI TTL-232R or TTL-234X cables)? If so, as you unplug that connector it can temporarily short the RX to GND.
EDIT: Like this: