CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Multiple LM75 addressing and reaching

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
brenato



Joined: 21 Oct 2013
Posts: 1

View user's profile Send private message

Multiple LM75 addressing and reaching
PostPosted: Mon Oct 21, 2013 1:21 am     Reply with quote

Hi all!

I have troubles with accessing multiple LM75 ics on i2c bus.
I made PCB with 5K pullups for SDA and SDL too.

I made addressing in
Code:

#DEFINE LM75a 0x9e     //sens nr3
#DEFINE LM75b 0x96     //sens nr2
#DEFINE LM75c 0x9c     //sens nr1
#DEFINE LM75d 0x90     //sens nr0

//1001   A0  A1   A2    + write 0 or read 1
//  9        0   0   0      0      =90h
//  9        1   1   1      0      =9Eh

When I choose LM75 I do the follow:
Code:

t1=gettemperature(lm75d);

void lm75_setandread(void)
{
   i2c_start();
   i2c_write(i2caddr);
   i2c_write(0x00);        // Pointer Byte

   i2c_start();
   i2c_write(i2caddr | 1);
   dataH = i2c_read();     // with ACK
   dataL = i2c_read(0);    // with NOACK
   i2c_stop();
}

My problem is that I can read each lm75 until I plug more then 1 device to the bus.
I made hardware config for A0-A2 pins. All ICs for different address.
If I connect just 1 from 4 then I can read the correct temperature value from each chip, each address. But when I connect 2 or more chip to the i2c bus then I have no data from chips.
What can be the problem?
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Oct 21, 2013 2:22 am     Reply with quote

You may well need lower pull-ups.

There are two 'limits' to the pull up resistors:
1) Minimum value - simple DC calculation based on the drive capabilities of the chips. Normally about 1.2KR, for a 'minimum rated' driver at 5v. Can be lower with lower supply voltage, and for many more powerful drivers.
2) Maximum value - depends on the speed being used, and the bus capacitance. Key thing here is that the bus capacitance will go up as you add more devices.... 4K7 is typically used for short I2C busses with just one device. 2K2 to 2K5, is normally needed for a 'slow' bus with multiple devices, while for a high speed bus with multiple devices, look at values more like 1K5.

It may just be that your wiring has significant capacitance, and adding another device is not allowing the line to get high quickly enough.

Forget your code for a moment, use PCM_programmers 'scanner' program, and test what it say. If it fails with multiple devices, lower the pull up resistors, and try again, till it finds all four devices. If the resistance if having to go very low (towards the minimum with all the devices), then try to work out ways of reducing your wiring capacitance....

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 21, 2013 5:31 am     Reply with quote

I have to agree with 'T' on this! I've run 4 sensors like your setup and needed to use 3K3r to get reliable communications using 5V PICs.
Like 'T' says, run the 'scanner' program first. It'll confirm your hardware is good and any problems after that could be software.

hth
jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group