# Why logic High input is logic low on I2C data bus?

#### naseeam

Joined Jan 4, 2017
45
NXP LPC11E68JBD48E Microcontroller I2C1 is Master. I2C1 is in Master Transmitter Mode.
I2C1 peripheral is in chapter 13. http://www.mouser.com/ds/2/302/UM10732-315822.pdf

NXP PCAL6416A I2C 16-bit I/O Expander is Slave. https://www.nxp.com/docs/en/data-sheet/PCAL6416A.pdf.

Master reads one byte from slave port 0. On one board all Eight bits are logic 1's as expected. On the other board Seven bits are logic 1's as expected
but bit 2 is logic 0. The input pin connected to bit 2 is pulled up to 3.3V but it's logic 0 on I2C data bus.
D7 D6 D5 D4 D3 D2 D1 D0
Expected 1 1 1 1 1 1 1 1
One board 1 1 1 1 1 1 1 1
Another board 1 1 1 1 1 0 1 1

Explanation/Questions on attached scope screenshots: Master sends slave address 0100 001(A6-A0), followed by write bit(logic 0). Slave responds with ACK(logic 0).
Then, master send command byte 0x00(read byte from Input port 0).
Master sends start bit, followed by slave address, followed by read bit(logic 1). Slave sends ACK.
On one board, slave send 0xFF as expected. On other board, slave sends 0xFB, not expected. Then, master sends NAK. Then, why is data bus pulled low before the stop condition?

The primary question is why is bit 2 logic 0 on the I2C bus when it's pulled up to 3.3V ?

Are we setting the I2C device properly?
INT pin(active low) is floating.
/* Enable selection of Pull Up / Pull Down on unused inputs */
b = mIOExtender.PuPdEnablePort0(0x02);
b = mIOExtender.PuPdEnablePort1(0x70);
/* Pull up unused inputs */
b = mIOExtender.PuPdSelectPort0(0xFF);
b = mIOExtender.PuPdSelectPort1(0xFF);

#### Attachments

• 8.4 KB Views: 4
• 9.4 KB Views: 4

#### BobaMosfet

Joined Jul 1, 2009
1,850
I2C is not parallel, it is serial. You only have 2 pins-- one for SDA, and oen for SCL, and what state they are in, sometimes in relation to one another determines state. To be perfectly honest, I don't think you have any idea of what you're doing. I've looked at the datasheets, and you don't seem to understand the difference between data buffer, control registers, and SDA/SCL signaling lines. You certainly aren't using the datasheet jargon, which means I can't tell what you're specifically referencing in terms of buffer, or register.

Are you managing other things first- there is quite a bit of initialization you have to do to use the I2C capability.

You mention pullups, but don't seem to understand the purpose of the pullups, and why the value might be different... pullups aren't there to enforce a level on an active circuit. They exist to encourage a default level on an inactive circuit.

.......oOo.....0o.....oOo.....

#### Attachments

• 37.1 KB Views: 5

#### naseeam

Joined Jan 4, 2017
45
>> I2C is not parallel
I know. What information in original post implies it is parallel.

>> I can't tell what you're specifically referencing in terms of buffer, or register.
Where in my post do I mentions buffer or register?

>> there is quite a bit of initialization you have to do to use the I2C capability
All initialization is done. I2C is working on another board. Please see my original post.

On one board, bit 2 on SDA line is logic 1 as expected. On another board, bit 2 on SDA line is logic 0.

#### BobaMosfet

Joined Jul 1, 2009
1,850
>> I2C is not parallel
I know. What information in original post implies it is parallel.

>> I can't tell what you're specifically referencing in terms of buffer, or register.
Where in my post do I mentions buffer or register?
>> there is quite a bit of initialization you have to do to use the I2C capability
All initialization is done. I2C is working on another board. Please see my original post.

On one board, bit 2 on SDA line is logic 1 as expected. On another board, bit 2 on SDA line is logic 0.
Regarding initiliazation, I looked at the datasheet, and there are control registers you need to be setting otherwise bits can get clobbered (see section 4.4.2 and beyond) for the ARM chip.

Regarding buffer .v. register, my point was that you should be referencing buffer or register, but you're not, so I don't know for certain which you're referring to.

Well, that suggests the board is bad, and wasn't that the issue previously? Have you got yet another board to try? And if it is a bad board, maybe you should stop using whatever service you're using for boards?

#### BobTPH

Joined Jun 5, 2013
3,658
It is unclear when and where you are looking at these data bits. Have you used a logic analyzer or scope to watch the I2C bus? Or are you talking about the output of the I/O expander after the data is sent?

Bob