I used MSP430f5438A.
I want to control the honeywell 3 Axis digital compass IC( I2C protocol ), but the chip address is defined 8 bit.
I can send 0x3C, I shift the address 0x1E, and UCB0CTL1 |= UCTR + UCTXSTT, so MSP430 can send address of 0x3C.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I used MSP430f5438A.
I want to control the honeywell 3 Axis digital compass IC( I2C protocol ), but the chip address is defined 8 bit.
I can send 0x3C, I shift the address 0x1E, and UCB0CTL1 |= UCTR + UCTXSTT, so MSP430 can send address of 0x3C.
See here... http://www.totalphase.com/support/kb/10039/ there's a section on 8-bit addresses.
Sending 0x3d 0x06 is impossible. THsi is neitehr a valid 10 bit address, nor does the 7/8 bit addressing allow sending a second 'address' byte in read mode.
If this is really required by the chip, then it is far, far outside the I2C specification.
When a start address is required befor ereading, all oteh rI2C chips I know of require a write addressing, hten send the address byte, then a repeated start is done fo read mode and data is read.
In your case, after sending 0x3d, you can only receive data. Maybe your docs are wrong and you will indeed be able to receive 6 bytes of data after sending 0x3D (without actually sending the 0x06).
From the description, I seems that your sensor works the same way: after a 0x3c, the first byte sets the address pointer. And on every access, the pointer automatically increases. So you can send 0x3c 0x00 0x70 0xa0 0x00 to write to the first three registers (instead of doing three separate transfers). the address pointe rnow points to 0x03 where the data lies. Then receive 6 bytes with addres 0x3d (0x1e+UCTR clear). Next, set the address pointer back to data start by sending 0x3d 0x03.
It's also possible that the description is written for a high-level I2C library call, which determines by the 0x3d that this is read mode and takes the 0x06 for the number of bytes to be received.
In any case, in read mode, the only thing that's sent is the address byte. That's how I2C is defined. And how the hardware I2C support works on MSPs.
The only exception is 10 bit addressing mode, where the normal address byte is in the range of 0xf0 to 0xf7, which is invalid range for 7 bit addressing. This byte then is acknowledged by all slaves where the upper two address bits match. Then a second address byte follows with the lower 8 address bits. But this doesn't apply to your case, as 0x3c doesn't fall into the 0xf0-0xf7 range :)
**Attention** This is a public forum