I am interfacing MSP430FG4618 with DS1307 using I2c protocol. i am a newbeee in controller,
when i need to write to DS1307 i do the folowing procedure, but there is problem at bold line below, ( UCB0CTL1 |= UCTR+UCTXSTT; ) when this instruction is executed, the UCTXSTT bit does not set, i.e. it remains zero. i do not understand why this is, is there any hardware problem? please help
UCB0CTL1 |= UCSWRST; //force to have software reset
P3SEL |= 0x06;
UCB0CTL0 =UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_1+ UCSWRST; // Use ACLK, keep SW reset
UCB0BR0 = 1; // fSCL = ACLK/1 = 32.768kHz
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
IE2 |= UCB0RXIE; // Enable RX interrupt
UCB0I2CSA = 0xD0; // Set slave address
UCB0CTL1 |= UCTR+UCTXSTT; // I2C TX, start condition
UCB0TXBUF = 0x00; // adress of RTC where data is to be written
UCB0TXBUF = 0x43; // data = 43 second
// stop condition I2C
UCB0CTL1 |= UCTXSTP;
UCB0CTL1 &= ~UCTR; // I2C RX
UCB0CTL1 |= UCTXSTT; // I2C start condition
while(1)
{
UCB0I2CSA = 0xD0+0x01; // wait till reading from RTC
}
awaiting reply
thanks,
rohit