Two-wire interface Bus Question

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am controlling two items (a sensor and a 8-bit DAC) on my first AVR project which are controlled on two-wire buses with a clock and data line. I have heard some people insist on putting a current limiting resistor in series on the data line (maybe 330 ohms). Neither datasheet for either part claim this is necessary or recommended.

Should I be doing this? If so, does the clock not need the resistor because it will not be bi-directional?

Thanks for your comments.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What kind of bus? I2C? And what's the speed?

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

Are sensor and a 8-bit DAC on the same PCB ?

Insist, insist ..... take it as an advice, a recommendation :)
I usually take that precaution. It will prevent damage in case of a program-error, a short or just a silly mistake. Protection is not needed for a well working system. That's with all things in life. These measures show their value in case of things going wrong. Get the picture ?
Btw, I use resistors in the off-board-going ISP-lines (incl. reset) as well. It's a very simple way of keeping your tracks on the board ;)

AVR's are very forgiving. A short between an output-pin and ground or Vcc will (in general) not damage the AVR.
FYI, Dragon's are not forgiving.

Basically, pull-up's on clock- and datalines can be omitted if the AVR's pull-up are enabled. But if you put a scope-probe on these lines, you'll soon agree that a decent pull-up ( 2k2 if you stay on-board ) is a a good choice.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i2c specs do not require the series resistors, but it suggests they can be put there if the environment requires it. It does no harm. You can put the resistors there, and yes, to both pins. 330 ohms seems a bit high though, see the specs about bus voltage vs bus capacitance vs pull-up resistor size.

And how would you know if the clock is bi-directional or not? Do any of the devices use clock stretching? And even if the clock line is unidirectional, make sure it is open collector/open drain output, not a push-pull output (built-in twi uses it as open-drain).

- Jani

edit: btw, internal AVR pull-ups are so weak (50k, +/- 20k or so) it will probably break i2c bus rise timing specs, so I suggest putting external pull-up resistors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I2C recommends pullups on both clock and data because either device can drive either line (well, the data line for sure - that is REQUIRED for acks even in one-way transfers).

The common recommendation for 5V system pullups on I2C is 2.2K.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the input. The 8-bit dac is I2C, the sensor isn't (but very I2C like). The speed is very slow.

It sounds like I will put the CLR in line on both lines since it sounds like it won't hurt anything, and the chances of me making a programming mistake resulting in contention are greater than zero. It also sounds like pullups would be useful to incorporate too, even though I have been using the internal AVR pullup for communication up to this point.

Again, thanks for the advice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jcrollman wrote:
I have heard some people insist on putting a current limiting resistor in series on the data line (maybe 330 ohms).
I usually put 330 ohm current limiting resistors in series on both data and clock lines just as a precaution. I once destroyed a couple of I/O pins (not an AVR device) due to a programming error.

Don