Author Topic: I2C...resistors?  (Read 3975 times)

0 Members and 1 Guest are viewing this topic.

Offline BuddingContraptionistTopic starter

  • Jr. Member
  • **
  • Posts: 44
  • Helpful? 0
I2C...resistors?
« on: October 17, 2008, 08:27:45 PM »
I bought this rangefinder.  It lets you communicate via either I2C or Serial, and I want to do I2C (because it uses a 3.3v serial signal, and i don't want to build a 3.3-to-232 converter).  I've read this awesomely informative primer, and I have a question.  Page 4 says that because the SCL & SDA lines are bi-directional, the "open drain thus must be pulled up with resistors."

I have an axon which has that I2C bus in the upper right center of the board.  Can I wire straight from my SCL & SDA lines on my rangefinder directly to these pins on the axon, or do I need resistors?
« Last Edit: October 17, 2008, 08:32:06 PM by BuddingContraptionist »

Offline fendi

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: I2C...resistors?
« Reply #1 on: October 19, 2008, 10:39:18 AM »
i think maybe you should check first ,
if in SDA and SCL pin has a conection to resistor like pull up circuit. no need to add pull up resistor again.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: I2C...resistors?
« Reply #2 on: October 21, 2008, 12:02:39 AM »
From the SRF02 datasheet:
Quote
The SCL and SDA lines should each have a pull-up resistor to +5v somewhere on the I2C bus. You only need one pair of resistors, not a pair for every module.

There are no hardware resistors on the Axon I2C bus, but you can activate pull-up resistors in software.

Here is an i2c.c snippet from AVRlib:
Code: [Select]
// functions
void i2cInit(void)
{
// set pull-up resistors on I2C bus pins
// TODO: should #ifdef these
sbi(PORTC, 0); // i2c SCL on ATmega163,323,16,32,etc
sbi(PORTC, 1); // i2c SDA on ATmega163,323,16,32,etc
sbi(PORTD, 0); // i2c SCL on ATmega128,64
sbi(PORTD, 1); // i2c SDA on ATmega128,64

On the Axon, SCL is D0, and SDA is D1.

 


data_list