7 years, 6 months ago.

Using internal pullup resistors as pull up for I2C

Some MCUs are equipped with internal pull up resisters, which can optionally be connected to the I/O pins The interface pins on I2C devices are open collector and require a pull up resistor be connected to the I2C bus lines at some point. Does the MBED library I2C bus interface module provide methods which would allow using a MCU's internal pull up resistors as the required I2C pull up resistors

1 Answer

7 years, 6 months ago.

First make DigitalIn objects on the I2C pins. Then make the I2C object, and then use the DigitalIn objects to enable the PullUp resistors.

Do note that it is not exactly guaranteed to work, it depends also on the hardware implementation, and it is a bit of a workaround (so no, the I2C class does not implement it). Also in general the pull-up resistors are way higher ohmic than advices for I2C. That does not mean it won't work for sure, it does mean you shouldn't try it on very large I2C busses (large capacitance with large resistance means it will be too slow), and just stick to the 100kHz default speed, don't try to go faster.

Accepted Answer

Thanks Eric In the application in question We are using the SMT32F4 Microcontroller on the Multi-Tech Lora MDot module, which is equipped with configurable internal pull up/pull down resistors on the GPIO pins. The I2C bus for the application is very short and hosts only an single Bosch BM280 pressure, temperature and humidity sensor chip; therefore the internal pull may work despite the high resistor value (~ 30K ). Using them would eliminate the need to add external pull up resistors to our board. I add to the post if it works

posted by Steve Mylroie 23 Nov 2016