This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Slave does not ACK address

Hi foks,

I am trying to comunicate with EEPROM memory (Atmel 24C32) using I2C interface and MSP430F2621. I have done initialization of I2C interface, but when I am trying to address slave device (EEPROM), it does not ACK that.

void i2cInit() {
    P3SEL |= 0x06; //pin selection

    P3REN |= 0x06; //activationg pull-ups on these pins

    UCB0CTL1 = UCSWRST; //reset

    UCB0CTL0 = UCMODE_3 + UCSYNC + UCMST;
    UCB0CTL1 = UCSSEL_2 + UCSWRST;
    UCB0BR0 = 0x12; // fSCL = SMCLK/12 = ~100kHz
    UCB0BR1 = 0x00;

    UCB0CTL1 &= ~UCSWRST; //enable

}

int eepromWriteByte(unsigned int addr, unsigned char data) {
    int transmited = 0;
    do {
        transmited = 1;
        UCB0I2CSA = 0x50;// address of EEPROM
        UCB0CTL1 |= UCTR + UCTXSTT; //want to write + start bit
        while (UCB0CTL1 & UCTXSTT) {;}//!!!!STUCKED HERE!!!!

       if ((UCB0STAT & UCNACKIFG) != 0) {
            UCB0CTL1 |= UCTXSTP; //stop bit
            transmited = 0;
        }
    } while (!transmited); //retransmit

}

int main() {
    WDTCTL = WDTPW + WDTHOLD; //stoping watchdog

    i2cInit();

    eepromWriteByte(0x0000,0x13);

}

I am stucked at point in eepromWriteByte in while cycle after sending START BIT. Look in code.

I checked all the pins on EEPROM with multimetr, VCC +3.3V on VCC, SDA, SCL after running my app, so memory is connected correctly I think.

Any ideas?

Thanks a lot

  • It is not that the slave does not ACK. Even if the slave does not ACK, you'll see the STT bit cleared after the start condition and the slave address have been sent. (you just won't get a second TX interrupt if there was no ACK, and of of course the NACKIFG bit is set)

    The most generic question in this case is: did you put pullups onto the lines? I2C is an open collector bus, that means that nobody pulls the line high.
    The internal pullups of theMSP are deactivated when the lines are output (which the clock line always is), so you cannot use them ( I thought this too when I started with the 5438 and its internal pullups, but unfortunately it won't work)

    And as long as the I2C hardware sees the clock pin low (which it is without pullup), it won't start sending and assumes that a different master is currently doing something.

**Attention** This is a public forum