This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWI clock pull up

The data sheet recommends that both the TWI clock and data lines use pull ups and the GPIOs should be set to S0D1, essentially open collector drive. I can see the need for this on the data line, but if my I2C device does not do any clock stretching, is it safe to omit the pullup on the clock line and set the GPIO to S0S1?

I have tried this on my board and have seen no ill effects.

Parents
  • I'm not so sure about that.

    I set up my clock pin as follows:

      NRF_GPIO->PIN_CNF[twiInstance[twiHandle].clockPinNumber] =     \
        (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
      | (GPIO_PIN_CNF_DRIVE_S0S1     << GPIO_PIN_CNF_DRIVE_Pos) \
      | (NRF_GPIO_PIN_NOPULL    	 << GPIO_PIN_CNF_PULL_Pos)  \
      | (GPIO_PIN_CNF_INPUT_Disconnect  << GPIO_PIN_CNF_INPUT_Pos) \
      | (GPIO_PIN_CNF_DIR_Output      << GPIO_PIN_CNF_DIR_Pos);
    

    There is no external pullup. Attached is the scope trace of the clock pin.

    IMG_20160902_102434.jpg

    Of course, this only works if there is only one master and the slave device does not do any clock stretching.

Reply
  • I'm not so sure about that.

    I set up my clock pin as follows:

      NRF_GPIO->PIN_CNF[twiInstance[twiHandle].clockPinNumber] =     \
        (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
      | (GPIO_PIN_CNF_DRIVE_S0S1     << GPIO_PIN_CNF_DRIVE_Pos) \
      | (NRF_GPIO_PIN_NOPULL    	 << GPIO_PIN_CNF_PULL_Pos)  \
      | (GPIO_PIN_CNF_INPUT_Disconnect  << GPIO_PIN_CNF_INPUT_Pos) \
      | (GPIO_PIN_CNF_DIR_Output      << GPIO_PIN_CNF_DIR_Pos);
    

    There is no external pullup. Attached is the scope trace of the clock pin.

    IMG_20160902_102434.jpg

    Of course, this only works if there is only one master and the slave device does not do any clock stretching.

Children
Related