Ruth Hendrix

I2C, what happens when unproper pull up resistor value used

Discussion created by Ruth Hendrix Employee on Jan 24, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Sun Jul 10, 2005 8:24 pm    
Hi eveybody,

i am using a MC68HC908 I2C module, when interfaced with SRF08 ultrasonic sensor, i use 30kohms pull up resistors, the module does not send, i cannot see anything on the scope, i could send once, i think there is some unstability due to a wrong interfacing (resistor values???).
if anybody could help me with some code example or advices coming from some former troubles encountred dueto wrong resistor values, please don't hesistate to post a message.
Posted: Thu Jul 14, 2005 1:25 am    
A standard value of pullup for I2C buses is 4k7, if your bus lines are very long you will need to drive them harder but even so you should see something on your scope (even if it looks ugly). What device are you using? If you post your code it would help. If your timimg is not correct the 9s08gb60 I2C module tends to to simply stop working, for example I have had to put a small delay between writes to the I2C data register. Data or clock lines not returning high is a good sign of timing problems as above.
Posted: Fri Jul 15, 2005 8:41 am 
Hello, thanks for the reply, well here is the code, i can write so far but i cannot read anything i am trying to communicate with an ultrasonic sensor, the SRF08

PTD = 0x00;
PTD = MMSR; // Configures port D[7..0] as output

/////////////////// configuration///////////////////

MMCR1 = 0x8C;
MMCR2 |= 0x10;
MMCR2 &= 0xF7;

MMFDR = 0x06; //corresponds to a 6,25Khz for a 8Mhz bus frequency.

MMADR = 0xE0;

MMSR &= 0xBF;
MMDTR = 0x00;

MMSR &= 0xBF;
MMDTR = 0x51;

MMCR2 |=0x08;//////////////////////////////////////
MMCR2 &=0xEF;
MMCR2 |=0x10;//////////////////////////////////////
MMCR1 |=0x04;
MMADR = 0x07;


MMSR &= 0xBF;
MMDTR = 0x07;

i am using resistors of 18Kohms.
i noticed something when i run the program at the begging with the scope probe on the SDA pin the program does not work properly, but if it is connected to the SCL pin it is ok.
should i take higher resistor values???
the timing is not a problem cause i am running on debug mode and i give time to the target device.
thanks for the help.
Best regards

PS: the PTD port in the code is used to display the I2C status register, it allow me watch the thing

the register are accordign to the definition for the MC68HC908AP64 freescale microcontroller
Posted: Wed Jul 20, 2005 1:57 am    
Your scope probe should not affect the bus, the srf08 data sheet suggests 1k8 resistors not 18k. The srf08 won't respond to reads while it is ranging. Are you checking that the device is acknowledging when you are writing to it. Have you got any other i2c chips you could start communicating with
(pcf8574 i/o expander is a easy device to start with). Scope both the data and clock lines at the same time or you will not know what is going on (start, stop's etc). Sorry don't have the time to go through your code.
Posted: Tue Jul 26, 2005 11:27 am    
Hi, do you have any code for this device, i would appreciate to have something to start with for my MC68HC908AP.
Posted: Thu Jul 28, 2005 10:38 pm 
Check out the data sheet for the device. It is very simple to use and you can confirm your writes to it by looking at the i/o.