Sunday, March 11, 2007

I2C Communication Problem

There's a problem with using the Connii's Java API. It only allows a single byte as an address, but bytes are signed. Basically for the servo controller whose address is 0xc2, Java interprets it as an int thereby forcing you to cast it as a byte, but that turns it into -62, which the Connii interprets as 0xffc2 which is not a valid 7-bit address. I've emailed Telos tech support about this.

If this doesn't work it leaves us with a few options:
1.) Use Connii's C API and SWIG it.
2.) Use a MCU with a byte addres between 0 and 127 to act as a translator.
3.) Build our GUI with C/C++
4.) Go back to the idea of emulating I2C with serial port in Linux

I just heard back from the tech support:

"I2C supports only addresses from the range 0..127. For all other addresses you will get an exception. Some data sheets are using I2C addresses in an 8-bit format. To get the real address simply shift this address one to the right."

So basically the Connii API wants us to input 7-bit addresses, so we just need to right shift 0xc2 to 0x61.

No comments: