Using an Internal Pull-Up Resistor on P1[0] and P1[1] for EZI2C – KBA91166

Version: **

 

Question: How do you use an internal pull-up resistor on P1[0] and P1[1] for EZI2C?

 

Answer:

After calling EzI2C_Start() in main code, add the code snippet shown below to use an internal pull-up resistor on P1[0] and P1[1]:

//DM2:DM1:DM0 = 011; for resistive pull-up  PRT1DM0 |= 0x03; // 0000 0011  PRT1DM1 |= 0x03; // 0000 0011  PRT1DM2 &= ~0x03; // 0000 0000

Note that it is NOT recommended to use PSoC®'s internal pull-up resistor for EZI2C when there are multiple devices on the I2C bus. The I2C system could break when PSoC is not powered and the I2C master tries to communicate with some other slave. There is no pull-up on the bus because PSoC is not powered. This could cause the entire system to hang. To avoid this issue, use external pull-ups instead of PSoC's internal pull-up.