Part Number: MSP430F67791A
Tool/software: Code Composer Studio
I am presently working on I2C of msp430f67791A microcontroller & facing some issues with eeprom ( 24LC1025) interfacing. It is not getting initialized properly & hence not working. We are interfacing eeprom on the port pins P2.5 (clk) & P2.6 (data). while debugging we found that, it is not getting it's UCBBUSY flag cleared. & hence it is not initializing eeprom. my transmit init routine is as below. We are passing 0xC0 as prescale in below code. slave addres is 0x54.
void TI_USCI_I2C_transmitinit(unsigned char slave_address,unsigned char prescale){
P2SEL0 |= SDA_PIN | SCL_PIN;
UCB0CTLW0 |= UCSWRST; // Enable SW reset
UCB0CTLW0 |= UCMST | UCMODE_3 | UCSSEL_2 ;// I2C Master, use SMCLK
UCB0BR0 = prescale; // fSCL = SMCLK/160 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = slave_address; // Set slave address
UCB0CTLW0 &= ~UCSWRST; // Clear SW reset, resume operation
UCB0IE |= UCNACKIE;
UCB0IE &= ~UCRXIE0;
UCB0IE |= UCTXIE0; // Enable TX interrupt
}
unsigned char TI_USCI_I2C_notready(){
return (UCB0STATW & UCBBUSY);
}
We are calling above function & then checking for busy bit. like mentioned below.
TI_USCI_I2C_transmitinit(0x54,0xc0); // 0x96 init transmitting with USCI
while (TI_USCI_I2C_notready()); // wait for bus to be free
can I get any support ?
Regards,
Kalpana Nachnekar