I am using PIC32MX350 series controller, on one GPIO , that is defined as input , and input that pin goes form one SMPS (PN : - PSC35 , IO Name :- AC out). Since SMPS IO is open drain we add a pull up and RC filter i between so it filter any noise that comes form SMPS which can couple to is IO.

Here on Normal condition SMPS AC output is 0, so my micro controller need to read 0, but we read 1 and before filter at point A on scope it read 0 volt with lot of noise peak, after filter at point B , scope read 3.3V constant.

enter image description here

here when i forcefully short point A to GND via some wire than uC read 0.

Uc Datasheet read low detect 0.15*VDD, so that makes 3.3*0.15= 0.495V. and gor High it need more than 2.5V.

q1) what if applied voltage betwwen 0.5 and 2.5V, than what uC read this input since its undefined state, is it read 0 or one. Or it may depend what internally pin is pulled high or pulled low inside the uC.

Also when i remove uC then at point B scope read flat 0 line with no noise peak.

Please advise

  • \$\begingroup\$ SMPS link mouser.in/ProductDetail/MEAN-WELL/… \$\endgroup\$ – Bharav Dec 24 '18 at 18:13
  • 1
    \$\begingroup\$ I think your GPIO may not be correctly configured as an input. There's no other reason for 3.3V to appear at point "B" when point "A" is about 0V. \$\endgroup\$ – John D Dec 24 '18 at 18:22
  • \$\begingroup\$ Your uC may be susceptible to latch-up: who supplies 3.3V? (uC? SMPS?). What voltage is logic "high" from SMPS? How are uC, SMPS grounded (ground in schematic is missing)? \$\endgroup\$ – glen_geek Dec 24 '18 at 19:02
  • \$\begingroup\$ uC running fine , since i am toggling other output LED, SMPS generate 230VAC to 12V. and one dc to dc regulator used to converter this 12V to 3.3V. SMPS IO(AC out) is open drain, that wh i added pull on that line with LED. all ground are comman. \$\endgroup\$ – Bharav Dec 24 '18 at 19:12
  • 1
    \$\begingroup\$ When the voltage is in the "undefined" range the uC will read either a 1 or a 0 and this behavior can be random and be different from device to device. That is what undefined means. But if you are reading 3V3 constant then unless the noise is much more than 3V3 at point A I would expect that the pin is an output at the moment. \$\endgroup\$ – Cobusve Dec 25 '18 at 17:21

You're trying to test a couple of things at once, you should first isolate the systems.


First remove R68, and the unnecessary complicated pull-up - just connect a 10k resistor from the output to 3.3 volt, and check the levels manually. If this does not work as expected, there's no need to test the code.


Keep R68 off the board. Measure the voltage on B. Connect B to GND through a 10k resistor, measure the voltage on B again. Break the connection and connect B to 3.3 volt through a 10k resistor, measure the voltage on B a third time.

If the voltage stays close to 0 or close to 3.3 volt at all times, it's configured as an output. If it changes between 0 and 3.3 volts when you change the resistor target, it is at least not driving the pin.


After you know where the problem is you can try to write the shortest program you can possibly do that will set up the pin and read its state. The process of writing this minimal example usually helps you find the problem.

  • \$\begingroup\$ can try when back to office, but what i already tried to remove R68, and point B grounded with 1K resistor , and scope read 0 volt line at point B. Also on point A without removing anything if i ground A to GND point via some jumper wire, than uC read 0. \$\endgroup\$ – Bharav Dec 24 '18 at 18:50
  • 1
    \$\begingroup\$ @Bharav even if the GPIO is configured as an output, the input register can still reflect the state of the pin. So you could overwhelm the output drive by shorting the pin to ground and the input register would reflect the state change. \$\endgroup\$ – John D Dec 24 '18 at 19:32
  • \$\begingroup\$ @Bharav If you write a minimal piece of code that should work, you could always update the question with it, maybe someone who knows about the processor can figure out what the problem is. \$\endgroup\$ – pipe Dec 24 '18 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.