using i2c and serial with the same two pins?

Posted on
  • Hi,
    Since the MDBT42Q module is based on the nRF52832, and the nRF52832 chip can assign any two pins as SCL/SDA, can i use both i2c and serial with the same two pins? Not simultaneously, of course, but I would like to use them and switch between I2C and Serial on the fly.

    Thanks.

  • Since the pins will be connected to two devices - you might get unwanted results. I2c usually has a pull up so that might also cause issues with serial.

    Why can you just use another 2 pins an keep them separate?

  • Yes, you can swap between I2C and Serial 'on the fly' in Espruino without any trouble - but as @Wilberforce says it's unlikely that other devices you connect to will be as forgiving :)

  • my plan was to have different devices that I would plug in one at a time. For example, one day I would plug in an I2C LCD module and another day I would take that off and plug in a USB to serial cable. I guess I would be fine with that

  • Yes, totally - no problems at all :)

  • someone have tested serial and i2c over same pins with ds-d6 fitness tracker (which only have 2 gpios available without taking it apart and by default it is serial console) and switching to i2c worked fine. ttl serial is high when idle so pull up configuration should be similar with i2c and ttl serial.

    I guess it uses just internal configurable pull ups and not resistors on board but even if there are pull up resistors in ds-d6 the requirement for them should be similar for i2c and serial (?) so in general this combination should work.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

using i2c and serial with the same two pins?

Posted by Avatar for barry_b_benson @barry_b_benson

Actions