Dan,
You got it. Coding error. It looks like I had two instances of twi going on...
Everything is working fine now.
Many thanks!
//start read, then get n-1 responses
TWI_StartRead(pTwi, i2c_addr, i2c_register+i, 1);
if (!Embiic_WaitByteSent()) {//A NACK indicates a bad address, or broken com. Exit.
Error_Code = 100;
TWI_SendSTOPCondition(pTwi);
break;
}
for(i = 0; i < numOfBytes-1; i++) {
if (Embiic_WaitByteReceived()){
params[i] = TWI_ReadByte(pTwi);
} else {
params[i] = 0;
Error_Code = 101;
TWI_SendSTOPCondition(pTwi);
break;
}
}
if (Error_Code > 0) { //in case error from for loop above
break;
}
//now send stop before last receive request
TWI_SendSTOPCondition(pTwi);
if (Embiic_WaitByteReceived()){
params[i] = TWI_ReadByte(pTwi);
} else {
params[i] = 0;
Error_Code = 101;
TWI_SendSTOPCondition(pTwi);
break;
}
-Chris