Author Topic: MCU pin connection  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

Offline MihaTopic starter

  • Contributor
  • Posts: 36
  • Country: fi
MCU pin connection
« on: February 07, 2023, 09:50:18 am »
Hello.

MCU port need to receive diskret signal (0V/12V) 1kHz max.
I plan to use only 100k resistor to limit port current and some ceramic capacitor for noise immunity, like in the picture? Will MCU port protected well when 12V signal present?
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8179
  • Country: fi
Re: MCU pin connection
« Reply #1 on: February 07, 2023, 10:15:30 am »
That's good. Will work even without the pull-down resistor R5 (unless it's needed in case the source cannot actively pull down).

The 100k will limit the current to something easily handled by the protection diodes within the MCU (which usually can take a few mA). 100k + 100p will offer semi-decent ESD protection. What you will see is Vcc+0.3V at the input pin of the MCU, clamped by the internal protection diodes. Note that if the signal is present during power-down, the signal can supply power to the Vcc node of the MCU, until the supply capacitors fill up enough to try to boot the MCU.

RC time constant will be 100k*100p = 10 µs, which sounds quite sensible given the maximum input frequency of 1kHz. If you are not worried about the delay (phase shift) and won't need to go beyond 1kHz, you can use somewhat larger capacitor, maybe up to 470-1000pF, for even better filtration against high frequency noise, and ESD.
« Last Edit: February 07, 2023, 10:18:09 am by Siwastaja »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12864
Re: MCU pin connection
« Reply #2 on: February 07, 2023, 10:24:15 am »
Why not make R5 39K to better match the potential divider output to the MCU's logic levels?

@Siwastaja: Assuming R5 is not removed, err . . .shouldn't you be using the Thevenin equivalent resistance for the time constant calculation?
 

Offline MihaTopic starter

  • Contributor
  • Posts: 36
  • Country: fi
Re: MCU pin connection
« Reply #3 on: February 07, 2023, 12:41:17 pm »
That's good. Will work even without the pull-down resistor R5 (unless it's needed in case the source cannot actively pull down).
The 100k will limit the current to something easily handled by the protection diodes within the MCU (which usually can take a few mA). 100k + 100p will offer semi-decent ESD protection. What you will see is Vcc+0.3V at the input pin of the MCU, clamped by the internal protection diodes. Note that if the signal is present during power-down, the signal can supply power to the Vcc node of the MCU, until the supply capacitors fill up enough to try to boot the MCU.
RC time constant will be 100k*100p = 10 µs, which sounds quite sensible given the maximum input frequency of 1kHz. If you are not worried about the delay (phase shift) and won't need to go beyond 1kHz, you can use somewhat larger capacitor, maybe up to 470-1000pF, for even better filtration against high frequency noise, and ESD.
Why not make R5 39K to better match the potential divider output to the MCU's logic levels?

Thanks for detailed and fasts responses! Now I fully understand schematic behaviour, and all underwater rocks, that you pointed me (MCU parasitic powering and signal delay on the MCU port).
Yes, I will decrease R5 for better match MCU level to 12V signal level.

shouldn't you be using the Thevenin equivalent resistance for the time constant calculation?
I think to estimate the response time it is enough to calculate the R*C.
« Last Edit: February 07, 2023, 01:21:08 pm by Miha »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8179
  • Country: fi
Re: MCU pin connection
« Reply #4 on: February 07, 2023, 01:46:17 pm »
@Siwastaja: Assuming R5 is not removed, err . . .shouldn't you be using the Thevenin equivalent resistance for the time constant calculation?

Obviously yes, but then again the time calculated would indicate the time to reach 63.2% * 6.0V = 3.792V. With R5 removed, source resistance is now 100k and not 50k, but the voltage after one time constant has passed is now 63.2% * 12.0V = 7.584V.

In both cases, the ESD diodes are already clamping the voltage before one time constant.

R5 will help dissipate the capacitor faster.

If reproducing the exact duty cycle, or delay, is of any importance, I would recommend simulating the circuit in Spice. MCU input pin can be modeled as two generic schottky diodes, one going to GND and other to ideal +3.3V voltage source.

If you want to keep R5, then yes it's a good idea to lower its value to form a better matched voltage divider. Just don't go too far not to eat into logic level margins. Use the lowest possible actual value of that "12V" and make sure the output is then at least 3.0V or so.
« Last Edit: February 07, 2023, 01:47:48 pm by Siwastaja »
 
The following users thanked this post: Ian.M


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf