After some turmoil, I have retreated to the state where only 1 byte at a time may be read from a slave.
Figure 34-20. "TWI Read Operation with Multiple Data Bytes with or without Internal Address" in the SAM3X8E datasheet seems out of reach. (Page 729, of the 28-May-12 revision)
I have found that a NACK is always generated after the 1st read by some unidentified mechanism, making multiple byte reads impossible.
For the desired protocol, see Figure 34-10. "Master Read with Multiple Data Bytes" (Page 721).
It seems that the Arduino community has been driving in circles over this problem for years. For a sample:
http://code.google.com/p/arduino/issues/detail?id=28
I haven't been able to find a way to specify how the master (the Due) should respond for multiple sequential reads.
I have resorted to supporting only 1 byte reads for the foreseeable future. This, of course, is a hack in my 50+ device I2C network.
Any ideas/suggestions?
TWI_StartRead(WIRE_INTERFACE, i2c_addr, i2c_register, 1);
Embiic_WaitByteXferComplete();
for(i = 0; i < numOfBytes; i++) {
//Need to set STOP condition WHILE reading the last byte...
if ((i+1) == numOfBytes) {
TWI_SendSTOPCondition(WIRE_INTERFACE);
//DBG_PRINT("Sending last-byte STOP.");
}
Embiic_WaitByteReceived();
//DBG_PRINTLN("Read_I2C_Values: Byte Ready");
params[i] = TWI_ReadByte(WIRE_INTERFACE);
}
if (Embiic_WaitByteXferComplete()) {
DBG_PRINTLN("Read_I2C_Values: Transaction completed successfully.");
} else {
DBG_PRINTLN("Read_I2C_Values: Transaction nottacompleted.");
}