cancel
Showing results for 
Search instead for 
Did you mean: 

nucleo_g474: mysterious bytes received on UART Rx

pasuzw
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

13 REPLIES 13
TDK
Super User

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.

If you feel a post has answered your question, please click "Accept as Solution".
pasuzw
Associate II

pasuzw_0-1755842144002.png

Blue is Rx and Yello is Tx.   There seems no pull up on Rx, so it drops when UART cable is disconnected.

Ozone
Principal II

You are probably talking about a Windows host here.
Consider that the host USB drivers are not perfect either. Far from it, actually.

Mike_ST
ST Employee

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.

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.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.

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 ?

UART_RX_WITH_INTERNAL_PULL_UP.jpg

Mike_ST
ST Employee

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.

TDK
Super User

Something isn't right here. If you disconnect RX, and the internal pullup is enabled, the level will not drop.

If you feel a post has answered your question, please click "Accept as Solution".

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:

BobS_0-1756239257996.png