0

I have a project using an ATMEGA328P and a DS1337 RTC chip. The DS1337 is an 8 pin IC with VCC at pin 8 and GND at pin 4. According to the datasheet both pin 5 (SDA) and pin 6 (SCL) need an external pull-up. From what I read elsewhere, a pull-up of 4.7K to 10K for each I2C pin should be good enough. Considering the position of both I2C pins to each other and the VCC pin, I was thinking of simplifying things by using a shared 10K pull-up. This post suggests that it should be possible, but I am still not sure. Does anyone have experience with this, that is using a shared pull-up to an I2C connection? What could be some problems, if any, by doing this?

1
  • 2
    If you connect SDA and SCL to the same resistor, you're shorting them together. Does not sound like a good idea.
    – Mat
    Jul 1 at 15:50
3

You need at least one pull-up on the SDA pin and at least one pull-up on the SCL pin. You cannot use the same pull-up for both pins as you will be shorting the two pins together.

The pull-ups are required on the I2C signals, not the pins of a chip. If you have multiple chips on the I2C bus you only need one pull-up on each signal. It really doesn't matter (given that I2C buses are intended to be short) where on the signal the pull-up is in relation to any one chip.

I would personally say that 4.7kΩ to 10kΩ is too high. I don't use more than 3.3kΩ pull-ups for I2C, and more likely 1kΩ if I am using higher speed (e.g., 1MHz) I2C.

3
  • Thanks very much for your answer. I also had a feeling that connecting both pins together via the resistor was not a good idea, but the post I had mentioned made it sound plausible. Also the datasheet didn't give any indication of what kind of resistors to use or how to calculate their value and what info I found was between 4.7K and 10K. I tried with 10K each and it worked. However, there will also be a barometric sensor module (BMP180) attached which has its own internal resistors. Would this then mean I wouldn't need resistors for the DS1337 in the first place?
    – jhorv
    Jul 2 at 19:13
  • @jhorv The resistors only need to exist. It doesn't matter if they are in another module or wired direct to the bus. You can even have multiple resistors, in which case the resistance is just the parallel total of those resistances.
    – Majenko
    Jul 2 at 19:52
  • I made a mistake with the resistors. I forgot to pull the interrupt pin high, thus it was always low and that made it look like the DS1337 was waking the MCU. The DS1337 is not working with 10K resistors but neither with 1K resistors. I keep getting an I2C error 4. I will start a new question after doing some more tests and background research. Thanks again for your help.
    – jhorv
    Jul 5 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.