I2C EEprom SDA Line Stays Down.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2C EEprom SDA Line Stays Down.

2,331 Views
FWFan
Contributor III

Hi All,

 

I'm using MC9S08QE128, I'm actually using poll and isr iic.  I got them to work but after I read from the eeprom, the SDA line won't pull up.  Do you guys have any idea?  I've included my code just in case.  The reading part is in the ISR routine.

 

The only way to pull it up again is to probe the SCL with the multimeter and then probe the SDA.  This seems to bring it up again.

 

Thank you,

FWFan.

Labels (1)
0 Kudos
6 Replies

475 Views
bigmac
Specialist III

Hello FWFan,

 

Do you have external pullup resistors on both IIC bus lines?  If so, what value?  I would expect in the vicinity of 3k3.

 

Regards,

Mac

 

0 Kudos

475 Views
FWFan
Contributor III

Hi Bigmac,

 

I have external pullup resistors for both i2c buses.  They are all 10k values.  Two of them are from the demo board, two of them I added for the IIC1 bus.  I use IIC2 for the eeprom and IIC1 for the LCD.  It seems the eeprom does not release SDA after I do a read.  I've included a more updated code.

 

Thank you,

FWFan

0 Kudos

475 Views
MrBean
Contributor I

The "probing with a multimeter" hints something.

A multimeter usually contains a capacitor between its input, 100nF is common.

Putting a 100nF capacitor between ground and a high (pulled up by 10k) SCL-line will generate a clock pulse.

SDA, similar.

Looks like an ACK/STOP problem? 

 

I suggest you look at the end of the I2C transfer to eeprom (with scope or analyser), and compare what you see to what that eeprom needs according to its datasheet. (which eeprom ?)

0 Kudos

475 Views
FWFan
Contributor III

Hi MrBean,

 

My eeprom is from On Semi, but I think it's the same as the Fairchild NM24C02.  It's a 2k eeprom.  Looks like I send out a noack and stop the master after the reading is done:

 

case 2:
            eepromReadData[count] = IIC2D;
            IIC2C1_TXAK = 0; // send out ack after reception
            //IIC2C1_TX = 0;
            delay(10000);
            count++;
            if (count == (ARRAYSIZE+1)) { // taken into acount of 0xa1
              count = 0;
              IIC2C1_TXAK = 1;// no ack
              IIC2C1_MST = 0;
              rcvseq = 0;
              dsplyLabel(); // write lcd labels
            }
            break;

 

Do you think I should lower the pull up resistors to 3.3k as Bigmac may have hinted?  I'll also look at the scope as you said.

 

Thank you very much for your help.

FWFan

 

nm24c02_03.pdf

Message Edited by t.dowe on 2009-10-27 11:51 AM
0 Kudos

475 Views
MrBean
Contributor I

You must clear or set the TXAK-bit before the read.

ACK every (sequential) byte read, except the last one.

       case 2:            IIC2C1_TXAK = 0; // send out ack after reception            if (count == ARRAYSIZE-1)  //@last byte; declare ARRAY[size] gives ARRAY[0]..ARRAY[size-1]              IIC2C1_TXAK = 1;// no ack            eepromReadData[count] = IIC2D;

 

 

 

Message Edited by MrBean on 2009-03-16 13:12 01:12 PM
0 Kudos

475 Views
FWFan
Contributor III

Thank you MrBean.

I will try that.

 

FWFan

0 Kudos