Hello Jens,
When reading the slave device, I need to first send the register address of the slave I wish to read and then send the repeated START to start reading the device after setting the UCTR to 0(to set MSP as master receiver). but the repeated start never goes when I set the UCTR to 0 and then send START bit. Here is the code snippet :
UCB0CTL1 |= UCTXSTT; // Send Start and slave address UCB0TXBUF = 0x01; // Load TX buffer to send reg address while(( UCB0CTL1 & UCTXSTT) != 0); // Wait for address to be sent while(!(UCB0TXIFG & IFG2)); I2CReadInit(); // Init I2C module for a read operation while(UCB0STAT & UCBBUSY); // wait for channel to become free UCB0CTL1 |= UCTXSTT; // re-start condition generation while (( UCB0CTL1 & UCTXSTT) != 0); // Wait for address to be sent
The MSP doesn't send the second START in the code. Could you explain why?. The busy bit is set though.