Skip to main content
Graduate II
June 18, 2024
Solved

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

  • June 18, 2024
  • 5 replies
  • 4485 views

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.

    This topic has been closed for replies.
    Best answer by BarryWhit

    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. 

    5 replies

    BarryWhitAnswer
    Graduate II
    June 18, 2024

    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. 

    ChubsAuthor
    Graduate II
    June 25, 2024

    @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.

    Super User
    June 25, 2024

    @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 ...

    ChubsAuthor
    Graduate II
    June 26, 2024

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


    @Andrew Neil thanks for you suggestion.

    The key idea is IF things can be solved with a simple RC passives - why to indulge into another set of CMOS base solutions?

    Said that, I often use RS422 - TI's AM26C31/32 pair which are extremely low cost solutions for differential signaling.

    RS-485 for any EMC compliance ready system or any significant multi-MCU communication, no compromise there.

    In my experience we have been able to get away with offboard single ended cables of upto 3m when the speeds are below ~4.8kHz (our I2C based Temperature sensors) when using RC filtering not only for noise but also to reduce the rise & fall times & associated high frequency harmonics on the I/O cables. Have never ventured into anything beyond 4.8kHz speed on offboard single ended communications.

    Graduate II
    June 25, 2024

     (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.

     

    Graduate II
    June 25, 2024

    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.

    Super User
    June 25, 2024

    @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.

    Graduate II
    June 25, 2024

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

    Super User
    June 25, 2024

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