Using I 2C Pin with LVTTL Logic Input in PSoC® 4 – KBA223289

Version: **

 

Question:

Is it possible to have the input of I2C with LVTTL logic instead of CMOS logic in the PSoC 4 device?

 

Answer:

It is possible even though it is not direct. You must do this through a register write rather than any component settings modification. Refer to section "7.3.1 Digital Input Buffer" in the PSoC 4 Architecture TRM for information on the register that chooses the threshold between CMOS or LVTTL. The register name is GPIO_PRTx_PC. The PORT_VTRIP_SEL bit (GPIO_PRTx_PC[24]) decides the mode.

 

Note that this setting is for a Full Port. This means all the pins of that port will have the same threshold.

 

We can set this bit of the I2C port to 1 to make it LVTTL. We can use the CY_GET_REG32 macro to set only that bit.

 

This can be done with one extra line of code.

 

CY_SET_REG32(CYREG_GPIO_PRT3_PC, CY_GET_REG32(CYREG_GPIO_PRT3_PC)|0x01000000);

 

This is assuming Port 3 pins are used for I2C. The register name should be changed according to the use case.