From: Andrew Tinka <andrew.tinka@gm...> - 2008-06-21 10:58:36
I'm trying to interface a Honeywell electronic compass (HMC6352) to a
basix via the I2C bus.
I'm using a basix-400bt plugged into a breakout-gs. I haven't
attached anything else to the I2C bus.
I've found the following helpful entries in the mailing list archives:
example of using i2c with the HMC6352:
using i2c to do "registerless" transfers (send/receive instead of write/read):
My problem is that there appears to be something else at address 0x21.
With the HMC6352 disconnected, the following command:
i2c 0x21 sb 0x41
runs without an error. Normally, if there is no device responding to
an address, i2c should return an error message (since after the
address is clocked onto the I2C bus, nobody pulls SDA low for the ACK
bit). We can see this by running
i2c 0x22 sb 0x41
or almost any other address in place of 0x22; it returns an error.
Also, I can never read from the HMC6352. Regardless of whether it is
plugged in or not,
i2c 0x21 vb
i2c 0x21 vb2
i2c 0x21 vb4
i2c 0x21 sb 0x41; sleep 1; i2c 0x21 vb2
i2c 0x21 sb 0x41; sleep 1; i2c --count=2 0x21 rb 0x00
all fail. The oscilloscope shows that the address is sent out
correctly, but that on the 9th clock, SDA is still high; in other
words we are receiving NACK instead of ACK.
So there are two mysteries.
1) Why is "i2c 0x21 sb 0x41" succeeding, even when the HMC6352 is not
plugged in? Someone else must be sending the ACK bit... who?
2) Why does "i2c 0x21 vb" always fail, even when the HMC6352 is plugged in?
One possible answer to (2) is that the HMC6352 will only transmit
after a successful command (you have to send it 0x41 before it gives
you data). If the mystery I2C device is somehow interfering with
that, then maybe the HMC6352 is never getting the command and
therefore is never prepared to transmit. But I have no idea about
Get latest updates about Open Source Projects, Conferences and News.