Hey Folks,
Some of you may remember I just had a problem bit-banging an i2c interface to an eeprom, Microchip
24FC1025. That problem remains unsolved, with IAR and myself continuing to work on it, but right now, I am
trying to interface with the eeprom using the TI built-in I2C USCIB2. I have been fighting to make a very
simple (I thought) TI example titled "MSP430x54x_uscib0_i2c_08". I have minimally altered the example so I
can test it on our development board and view diagnostic msgs on hyperterminal on a PC. I can send the code
if you think it is needed.
The example program takes an array of 5 unsigned chars, sets the pointer to the start of the array and
the byte counter to sizeof the array. I then reset a write protect pin and call the start condition with
UCTR set. I can tell from msgs embedded in the ISR that the isr executed 5 times. I am viewing output of
clk and data on a scope. The patterns seem normal, and the slave address is sent and it appears that I
receive an ack because the data line remains low.
The problem is that I see no scope patterns indicating data bytes have been sent. Can someone please
suggest what to try next? This is the isr:
//------------------------------------------------------------------------------
// The USCIAB0TX_ISR is structured such that it can be used to transmit any
// number of bytes by pre-loading TXByteCtr with the byte count. Also, TXData
// points to the next byte to transmit.
//------------------------------------------------------------------------------
#pragma vector = USCI_B2_VECTOR
__interrupt void USCI_B2_ISR(void)
{
switch(__even_in_range(UCB2IV,12))
{
case 0: break; // Vector 0: No interrupts
case 2: break; // Vector 2: ALIFG
case 4: break; // Vector 4: NACKIFG
case 6: break; // Vector 6: STTIFG
case 8: break; // Vector 8: STPIFG
case 10: break; // Vector 10: RXIFG
case 12: // Vector 12: TXIFG
if (TXByteCtr) // Check TX byte counter
{
#if 1 // print out??
sprintf(outBuf, "ISR::%X", *PTxData);
TxBuffer(outBuf, 10, 1);
#endif // print out??
UCB2TXBUF = *PTxData++; // Load TX buffer
TXByteCtr--; // Decrement TX byte counter
}
else
{
UCB2CTL1 |= UCTXSTP; // I2C stop condition
UCB2IFG &= ~UCTXIFG; // Clear USCI_B2 TX int flag
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
}
default: break;
}
}
Thanks,
Mike Raines