cancel
Showing results for 
Search instead for 
Did you mean: 

UART Rx Pin Input Impedance for RC Low Pass Filter Design [STM32 MCUs]

Chubs
Associate III

Hello Community,

I am trying to confirm with you all a design decision for RC based Low Pass Filter that I plan to install on my the UART Rx pin as the STM32G0 Errata mentions this pin has to have a filtered/noise free input to avoid glitches.

I am trying to re-confirm what is the input impedance for the UART Input pin on STM32G series MCUs? Is it a fair assumption that all input pins irrespective of the peripheral (ie UART/I2C/SPI etc) have high input impedance in Mohm range?

Kindly suggest/share your experience of using RC Filter on UART Rx input.

1 ACCEPTED SOLUTION

Accepted Solutions
BarryWhit
Senior

I don't know the G0 family in particular but I think ST doesn't generally specify input impedance for GPIO pins.

 

The errata says:

"In all modes, except synchronous slave mode, the received data may be corrupted if a glitch to zero shorter than the half-bit occurs on the receive line within the second half of the stop bit."

 

Note that the preferred "solution" given there is to simply make sure your line is sufficiently free of noise. You do this with proper board layout, or with shielded twisted pair wires (if you're prototyping).   Have you verified that your system has this issue, or are you just trying to design defensively?

 

I'm not sure an RC filter is what's needed in case you have this kind of problem. It really depends on what the noise looks like. Try to identify (and characterize) the source of the noise first, and go from there. 

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.

View solution in original post

11 REPLIES 11
BarryWhit
Senior

I don't know the G0 family in particular but I think ST doesn't generally specify input impedance for GPIO pins.

 

The errata says:

"In all modes, except synchronous slave mode, the received data may be corrupted if a glitch to zero shorter than the half-bit occurs on the receive line within the second half of the stop bit."

 

Note that the preferred "solution" given there is to simply make sure your line is sufficiently free of noise. You do this with proper board layout, or with shielded twisted pair wires (if you're prototyping).   Have you verified that your system has this issue, or are you just trying to design defensively?

 

I'm not sure an RC filter is what's needed in case you have this kind of problem. It really depends on what the noise looks like. Try to identify (and characterize) the source of the noise first, and go from there. 

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.
Chubs
Associate III

@BarryWhit,

Thanks for your response to the query. The use case is where we have UART interfacing with a offboard remote device (20kbps at about ~20cm of unshielded Twisted pair of cable from a remote wireless MCU) so a RC filter makes a lot of sense. Having said that, I want to understand if someone has implemented RC filters on USART before.

Any suggestions/feedback/experiences might be helpful.


@Chubs wrote:

I want to understand if someone has implemented RC filters on USART before.


UARTs have been around since almost the beginning of electronic computing time - so I'm sure it has been done!

Try an internet search for "UART noise filter"

If noise is really an issue, consider using RS232 or RS422 or similar ...

BarryWhit
Senior

 (20kbps at about ~20cm of unshielded Twisted pair of cable from a remote wireless MCU) so a RC filter makes a lot of sense. 

 

so shield the wire. also, this isn't differential, so when I said twisted pair this only helps (I think) if you use one pair pair line. I.e. SHIELD(RX/GND), and SHIELD(RT/GND). But for 20cm that maybe overkill (Really, 20cm?? are you installing it inside a tesla coil or something?). which reduces the loop area. Or maybe I'm just talking rot.

Also note that, if you need to run cables for any serious length, you really should use a differential interface (i.e. RS485). Which also handles the ground voltage differences. and isolators.  20cm should not require any of this. Or an RC filter for that matter unless it's in a welding factory.

 

But ok, fair enough. I'm just not sure why you need the input impedance for that. For an RC filter, you would need a *series* resistor and a shunt capacitor. Yes, you want to know that the input impedance is high enough to as not to load anything, but practically speaking - it's obvious it won't. For other pins (NRST) the datasheet says 50kohm, that should be enough to allay (sp.?) any fears you have.

 

Note that the RC filter will only be effective if the noise on your line is of significantly higher frequency than the UART baudrate. That's why I said you need to characterize your noise source. If your noise can flip a bit for a duration of more than baud/16 (or perhaps even less, the errata only says "less than x"), this will not solve your problem. So, it depends.

 

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.
BarryWhit
Senior

But wouldn't you use a series resistor and a shunt capacitor for such a filter? what does the input impedance matter? you can assume it is large *enough* so as not to load down anything. 

 

If noise is really an issue, consider using RS232 or RS422 or similar ...

You probably meant RS422 or RS485. Yep, for any distance/noisy environment, differential signalling is definitely the way to go.

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.

@BarryWhit wrote:

You probably meant RS422 or RS485. 


I did mean RS232, as OP mentioned only short distance & low speed - it would have better noise immunity than just 3V logic. The transceiver would probably also help with some filtering/noise-rejection.

Of course, differential (RS422, etc) would be better still.

BarryWhit
Senior

ah. You were suggesting higher voltages for more noise margin. right.

- If you feel a post has answered your question, please click "Accept as Solution".
- Once you've solved your issue, please consider posting a summary with any additional details you've learned. Your new knowledge may help others in the future.

Indeed - and not only higher voltages, but also bipolar => greater noise margin.

@BarryWhit precisely my point, while selecting shunt series resistor & shunt capacitor I am trying to understand what the boundary for large enough was for typical STM32 Rx inputs pins - we have some idea for typical GPIO based input which is in MOhm range (due to current range in microA), but to be sure trying to get cite-able information here)

Point being - I normally do not add Capacitance beyond 0.5 to 1nF on any data line - that brings down my decision to increasing the shunt Resistor & to avoid creating voltage divider it is better to know/confirm/reaffirm the input impedance.

 

Hope you guys get the intention of this post & if you find any cite-able source for the input impedance of these pins - it might help anyone & everyone in future.