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

Help Please...External EEPROM chip never responds

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







Help Please...External EEPROM chip never responds
PostPosted: Tue Apr 27, 2004 12:34 pm     Reply with quote

Hi Everyone,
I am trying to use a 24c00 chip along with my PIC16c771 to implement I2C bus for the storage of variables.

For some reason the EEPROM chip never ACKs any of the commands sent by the micro. I'm attaching a picture of a waverform that tries to write a byte of data to the EEPROM chip. As you can see, first there is a start condition, then the control byte 1010xxx0. But after the control byte, the EEPROM chip is supposed to ACK and it never does.

Do any of you see anything wrong in the waveform?

The Green is SCL, Yellow is SDA.



Thanks
fpgeh



Joined: 07 Sep 2003
Posts: 19
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Tue Apr 27, 2004 12:42 pm     Reply with quote

Your rise times look a bit long. You can probably reduce the size of the pullup resistors. With the time div. you have set (25us) it looks like your rise times could be near 5us. The spec sheet gives a max rise time of 1000ns.

Also, how many devices are on the bus? If there are a lot, then bus capacitance will be high resulting in longer rise times.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Apr 27, 2004 12:47 pm     Reply with quote

Do you have pull up resistors on the SDA and SCL lines?
Kosta
Guest







PostPosted: Tue Apr 27, 2004 12:57 pm     Reply with quote

Yes I do have pull up resistors on both the signals.
I tried to reduce them from 10k to 2.4K just now.
The rise time became much smaller and the signals looked almost like perfect square waves but still the EEPROM chip isn't responding.

And I just have a master and slave on the I2C bus so capacitance from that should not be an issue.
fpgeh



Joined: 07 Sep 2003
Posts: 19
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Tue Apr 27, 2004 4:41 pm     Reply with quote

From your pic, the I2C signals look correct. Are you sure SCL and SDA aren't swapped? Did you check the power connections? And have you tried another EEPROM chip? Maybe one burned out.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Apr 28, 2004 8:26 am     Reply with quote

Are you using the built in I2C functions or are you trying to 'bit bang' the signals? Maybe if you posted a bit of your code it might help too.
Kostik
Guest







PostPosted: Wed Apr 28, 2004 9:40 am     Reply with quote

I checked the lines and they are connected properly. I will also try a different chip.

I'm using the built in functions. My compiler is pretty old v. 3.056. I don't know if that makes a difference or not.

Here's a bit of my code. Maybe you might see something wrong in it.
It is just a snip of it so not everything, like the main loop, defines, etc. is included.

Code:

#include <16C771.h>
#device ADC=12
#use delay(clock=4000000)

#fuses XT,NOWDT,BROWNOUT
#use i2c(MASTER, FORCE_HW, FAST, SCL=PIN_B2, SDA=PIN_B4)

// following just runs once
output_float(PIN_B2);
output_float(PIN_B4);

write_eeprom(BYTE_ADDR1, 0xF8);


void write_eeprom(byte address, byte data) {
   int ack = 0;
   i2c_start();
   ack = i2c_write(0xa0);
   ack = i2c_write(address);
   ack = i2c_write(data);
   i2c_stop();
   delay_ms(11);
}

byte read_eeprom(byte address) {
   byte data;

   i2c_start();
   i2c_write(0xa0);
   i2c_write(address);
   i2c_start();
   i2c_write(0xa1);
   data=i2c_read(0);
   i2c_stop();
   return(data);
}


Thanks!
Kostik
Guest







PostPosted: Wed Apr 28, 2004 12:20 pm     Reply with quote

Guys it was a bad EEPROM chip.....

Thanks for all the help.
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