Here is some code showing the use of getI2CStatistics
void
printI2cStats()
{
TI2cStatistics i2c_stats;
// Get the I2C bus statistics
getI2CStatistics(&i2c_stats, sizeof(i2c_stats));
// print some of the statistics
writeDebugStreamLine("I2C Stats ..................");
writeDebugStreamLine("Number of encoders %d", i2c_stats.nNumbOfI2CPortsDetected );
writeDebugStreamLine("Milisec Ticks %d", i2c_stats.nTotal1MillisecondTicks );
writeDebugStreamLine("Total Polling Cycles %d", i2c_stats.nTotalPollingCycles );
writeDebugStreamLine("Idle Polling Cycles %d", i2c_stats.nTotalIdlePollingCycles );
writeDebugStreamLine("Total Messages %d", i2c_stats.nTotalI2cMessagesSent );
writeDebugStreamLine("Total Messages Successful %d", i2c_stats.nTotalI2cMessagesSuccessful );
}
task main()
{
while(1)
{
printI2cStats();
wait1Msec(1000);
}
}
also see an example of its use here.
https://vexforum.com/showpost.php?p=329120&postcount=4