1
\$\begingroup\$

Quite a obscure question here, concerning a very specific I2C expander IC, however I believe that this example can be replicated with most expander bus ICs.

I am using a PCA9536 to switch the 4 pins on and off and read the states of inputs.

PCA9536 Datasheet here

When using the PCA9536, a command register can be used to determine, pin direction, state and even inverse the incoming logic.

My application requires the ability to read the electrical state of any given pin at any given moment, regardless of whether its an input or output.

This IC supposedly does this (page 16):

7.3.2.3 Register Descriptions

The Input Port register (register 0) reflects the incoming logic levels of the pins, regardless of whether the pin is defined as an input or an output by the Configuration register.

So, to test this, I conducted the following two tests:

  • Test A

I have set a pin to be an output and made it LOW, then pulled it HIGH

Reading the value of the pin, using I2C Register 0, returns a value of HIGH.

GREAT!

  • Test B

I have set a pin to be an output and made it HIGH, then pulled it LOW

Reading the value of the pin using I2C Register 0, returns a value of HIGH.

NOT GREAT!

This is my problem, as I need to detect a short HIGH or LOW.

What are the possible reasons for this and is there a workaround please? Thank you in advance for any help you can offer me.

\$\endgroup\$
  • 3
    \$\begingroup\$ How are you pulling this pin high or low against its output state? Why are you doing this to that poor device? Do you realize that you're probably going to break it? The point of reading the pin state when it's an output isn't so that you can force it to some other state, it's just so that you can read the output state. \$\endgroup\$ – brhans Jul 23 '18 at 11:40
  • \$\begingroup\$ Connecting it directly to pos or gnd. Yes, this is precisely why i want to read it, for detecting shorts and electrical errors. \$\endgroup\$ – GeoReb Jul 23 '18 at 11:41
  • 2
    \$\begingroup\$ Yeah .... well ... I can smell the magic smoke leaking out from over here. \$\endgroup\$ – brhans Jul 23 '18 at 11:42
  • 2
    \$\begingroup\$ You're not supposed to pull an output pin in any direction, output is output and is therefore a driving pin. Pulling a high pin low means you're applying a short to the driver stage of that pin. \$\endgroup\$ – Humpawumpa Jul 23 '18 at 11:42
  • \$\begingroup\$ I am in agreement with you. The reason for wanting to detect the pin being pulled the wrong direction is to alert the user of a short or miswire. \$\endgroup\$ – GeoReb Jul 23 '18 at 11:43
0
\$\begingroup\$

Your I2C software must be somehow deficient, or your "short" is not strong enough to drag the pin voltage below logic "0" threshold. According to simplified block diagram for 9536 I/O ports,

enter image description here

the pin pad is directly connected to D input of the internal read register. So if the output is set to "1" but shorted to ground (using tweezers), the high-side transistor Q1 will be overpowered to ground, and a read from I2C register "0" should sense this. And it indeed does this, as I just verified.

According to the PCA9536 datasheet, the high-side driver (Q1) has an impedance of about 50 Ohms (10 mA load drags the output level by 500 mV). Whether the shorting of pin driven internally to "1" is damaging the IC or not is a different question.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer @AliChen. You verified this on an actual device!? That's so helpful :) Please excuse me for asking twice, but to clarify, when you held a high pin to GND, you were given a LOW reading on REG 0? I should be getting the same, but I am not. I am pulling the pin straight to GND... \$\endgroup\$ – GeoReb Jul 23 '18 at 16:50
  • \$\begingroup\$ @GeoReb, yes, I verified this on actual hardware. All data was set to FF, and a crowbar of pin3 to pin4 produces "FB", bit 2 reads "LOW". You need to have a "short" with something less than 5-10 Ohms (the VIL is specified as <0.8V, if this is really true). \$\endgroup\$ – Ale..chenski Jul 23 '18 at 16:57
  • \$\begingroup\$ Thank you very much for your detailed help with this problem @AliChen. Turns out that I didn't have a strong enough ground, as you suggested. Interestingly though, I was able to use a ground with a 20 Ohm resistance and still achieve the desired results. Thank you again. \$\endgroup\$ – GeoReb Jul 24 '18 at 13:43
  • \$\begingroup\$ @GeoReb, you are welcome. The 20 Ohms is not surprising, because this is CMOS, and the LOW level threshold should be about half of Vdd, not just 0.8V per specifications. So a 45-Ohm to ground should do the job as well, but the high-side driver is 50 Ohms worst case, and can be smaller, 30-40 Ohms, so 20-30 Ohms should drag the pin reliably below CMOS threshold for all manufacturing corners. \$\endgroup\$ – Ale..chenski Jul 24 '18 at 15:14

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.