mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Issue: I2C not enabling open collector mode properly on I2C1 and I2C2

On the NXP LPC4088, when I2C1 is configured to use P0.19 and P0.20, open collector mode is not being enabled on these pins. This is causing failure to communicate as slave devices cannot drive the bus low against the default push-pull pin configuration.

The same problem exists for I2C2 when it uses P0.10 and P0.11.

Both problems can be seen in LPCXpresso by displaying the contents of the IOCON registers.

In my case I worked around these problems and restored full I2C operation in my application with the following:

Disable high drive (enable "simulated open-drain output") for I2C1 and I2C2. LPC_IOCON->P0_19 |= (1 << 10); I2C1 LPC_IOCON->P0_20 |= (1 << 10); LPC_IOCON->P0_10 |= (1 << 10); I2C2 LPC_IOCON->P0_11 |= (1 << 10);

You should modify i2c_init() in .../targets/hal/TARGET_NXP/TARGET_LPC408X/i2c_api.c to fix this problem properly for all LPC4088 pins that are capable of being used for I2C1 and I2C2.

Regards, Rick Low Ottawa, Canada

1 comment:

02 Dec 2014

(Sorry, let's try that again with proper formatting.)

On the NXP LPC4088, when I2C1 is configured to use P0.19 and P0.20, open collector mode is not being enabled on these pins. This is causing failure to communicate as slave devices cannot drive the bus low against the default push-pull pin configuration.

The same problem exists for I2C2 when it uses P0.10 and P0.11.

Both problems can be seen in LPCXpresso by displaying the contents of the IOCON registers.

In my case I worked around these problems and restored full I2C operation in my application with the following:

workaround for I2C1 and I2C2 open collector configuration

	// Disable high drive (enable "simulated open-drain output") for I2C1 and I2C2.
	LPC_IOCON->P0_19 |= (1 << 10);			// I2C1
	LPC_IOCON->P0_20 |= (1 << 10);
	LPC_IOCON->P0_10 |= (1 << 10);			// I2C2
	LPC_IOCON->P0_11 |= (1 << 10);

You should modify i2c_init() in .../targets/hal/TARGET_NXP/TARGET_LPC408X/i2c_api.c to fix this problem properly for all LPC4088 pins that are capable of being used for I2C1 and I2C2.

Regards, Rick Low, Ottawa, Canada