I'm trying to get my MSP430 to talk to a MPU-6050 sensor via I2C. If anyone can spot-check this hardware and see if there's a problem there, I'd be grateful. The resistors are connected to the red rail. Right now they're 2.2k, but I've also tried 8k and 10k.
And the code keeps getting snagged at the line indicated below. Pretty sure the slave isn't sending back an acknowledge signal:
while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent (UCTXSTP auto clears after STOP is sent)
UCB0CTL1 |= UCTR + UCTXSTT; // I2C start condition with UCTR flag for transmit
while((IFG2 & UCB0TXIFG) == 0); //UCB0TXIFG is set immidiately (UCB0TXIFG is set to indicate TXBUF is ready for more data)
UCB0TXBUF = registerAddr; //write registerAddr in TX buffer
__delay_cycles(1000);
while((IFG2 & UCB0TXIFG) == 0); // CODE GETS STUCK HERE.
//wait until TX buffer is empty and transmitted
UCB0CTL1 &= ~UCTR; // Clear I2C TX flag for receive
UCB0CTL1 |= UCTXSTT + UCTXNACK; // I2C start condition with NACK for single byte reading
while (UCB0CTL1 & UCTXSTT); // Start condition sent? RXBuffer full?
receivedByte = UCB0RXBUF;
UCB0CTL1 |= UCTXSTP; // I2C stop condition
return receivedByte;
Best Answer
According to the photograph, the sensor's logic I/O reference voltage is not connected and floating.