I've interfaced a Honeywell HMC6343 compass chip to an xmega128a1 processor using the TWI interface. The driver code I used was based on AVR1308 "Using the XMEGA TWI" and the example code.
I'm using a custom board that has the xmega128a1 processor and an at86rf212 chip on it. The compass chip was purchased on a carrier board from www.spartkfun.com. To develop my code I wired the compass chip to our current production board (we intend to re-spin the board later with the HMC6343 on it). The I2C bus is running at the standard rate of 100khz.
On two of our boards the compass chip communicates correctly with the xmega twi and we get no errors. Note that the The functions TWI_MasterWrite() and TWI_MasterRead() both return a bool value as a 'success' or 'fail' indication. My application will return an error message to the user interface should an I2C error occur.
On two other boards we either get errors from the TWI code, or the read function is returning either all zeros or all ones. As far as we can tell both boards trace out correctly. The processors on all of our boards have the same date code. The other parts of our application code work correctly, ONLY the TWI interface has problems. On the two boards that work correctly we NEVER see any failures, on the boards that don't work they NEVER work. The twi_init() function does not fail the first time it is called, but will fail if called a second time without a hardware reset.
I haven't found any serious errata on the XMEGA-A1 TWI function, has anybody had issues with this function? It seems strange that I'm seeing a 50-50 chance of the same code working on different devices. BTW we used the SAME HMC6343 chip on all 4 of our modules so the problem seems to be with the xmega cpu alone ... unless we have an invisible partial short on our boards. The speed involved here is too slow to be crosstalk and the wiring was identical on all 4 boards anyway.