xmega TWI problems?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you have four of your new boards and it only works on two of them? If you have four identical boards with identical code and only two of them works it should be a hardware problem somewhere. If it's an error in the silicon that's really bad!

Can you check out the TWI lines on the scope to compare working / non-working?

Dan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GordonFreeman wrote:
So you have four of your new boards and it only works on two of them? If you have four identical boards with identical code and only two of them works it should be a hardware problem somewhere. If it's an error in the silicon that's really bad!

Can you check out the TWI lines on the scope to compare working / non-working?

Dan

I asked our HW engineer to put a scope on the I2C lines and see if it looked correct. I posted the question here because there is enough errata posted for the xmegas that I wondered if there was something I missed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like a hardware or hardware setup issue to me too. We're using the TWI for inter processor comms without any issues on the xmega128A1. Are the fuses set up the same between the different boards?