The i2c bus is physically probably 4" with 2kΩ pullups to +3.3V. Two devices on the bus, an ADAU1966 and ADAU1445. I'm writing to the ADAU1445. It's about 13KB of data in an array. The part supports burst mode, where you write the 'register address' (looks like first 2 data words to i2c) then as many bytes as you want. Here's the code for writing a block (note, it depends on Erich Styger's 'generic I2C' Processor Expert module):
void SIGMA_WRITE_REGISTER_BLOCK( byte devAddress, int address, int length, ADI_REG_TYPE* pData )
{
word addrBuf = address;
byte ret = ERR_OK;
/*
while( length > WRITE_SIZE )
{
ret = I2Cbus_WriteAddress(ADAU1445_BASE_ADDR + devAddress, &addrBuf, sizeof(addrBuf), pData, WRITE_SIZE);
Sigma_ErrCheck( ret, "SIGMA_WRITE_REGISTER_BLOCK (big)");
addrBuf += WRITE_SIZE;
pData += WRITE_SIZE;
length -= WRITE_SIZE;
FRTOS1_vTaskDelay(1/portTICK_RATE_MS);
}
if( length > 0)
{
ret = I2Cbus_WriteAddress(ADAU1445_BASE_ADDR + devAddress, &addrBuf, sizeof(addrBuf), pData, length);
Sigma_ErrCheck( ret, "SIGMA_WRITE_REGISTER_BLOCK");
}
*/
if (I2Cbus_SelectSlave(ADAU1445_BASE_ADDR + devAddress) != ERR_OK)
{
ret = ERR_FAILED;
}
else
{
ret = I2Cbus_WriteBlock(&addrBuf, sizeof(addrBuf), I2Cbus_DO_NOT_SEND_STOP);
if( ret == ERR_OK)
ret = I2Cbus_WriteBlock(pData, length, I2Cbus_SEND_STOP);
}
if (I2Cbus_UnselectSlave() != ERR_OK)
{
ret = ERR_FAILED;
}
Sigma_ErrCheck( ret, "SIGMA_WRITE_REGISTER_BLOCK");
}
(notes: Sigma_ErrCheck() simply prints out an error message if ret != ERR_OK. You can see a previous version of the function commented out above the current version)
And here's a scope capture of a typical transaction (same part - note, this is not the same transaction as captured by the logic analyzer above, actually it's the beginning of that transaction)
