Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

I2C application


#1

hello,

i have a question about the Serial-to-I²C Application,
I’m wondering how to send the sequence.
The documentation (pololu.com/docs/0J46/9.e) indicates :

[quote]For example, to write the value 0x2E to register 0xF4 on a slave device with the write address 0xEE, the following sequence of bytes could be sent to the Wixel:

‘S’, 0xEE, 2, 0xF4, 0x2E, ‘P’[/quote]

  1. Does the sequence should be sent in a whole at a time ?
    i.e sending ‘S\0xEE\0x02\0xF4\0x2EP’ or send each byte in different packet ?

  2. is it necessary to send the comma as a separator to the wixel ?
    i.e sending ‘S,\0xEE,\0x02,\0xF4,\0x2E,P’

Thanks.


#2

Hello.

As long as your time between bytes is less than cmd_timeout_ms, you can send them together (an array of bytes) or apart (one byte at a time) as you would like. Also, ‘0x02’ is not the same as ‘2’; the HEX value for ‘2’ is ‘0x032’. Most likely you would get an error if you send that command sequence you listed above. You should probably send ‘2’ and not ‘0x02’.

No, the commas are not actually sent to the Wixel; the commas shown in the Wixel user’s guide are there to make it readable.

- Amanda


#3

Ok,

thanks for your answer Amanda !


#4

Hello,

I’m a bit confused with I2C addressing.
I use the BMP180 temp sensor with my raspberry Pi,
and i wish to move the sensor to remote place using wixels for communications.
On the Pi, the address of the sensor reported by i2cdetect shows 0x77,
but the datasheet of the sensor indicates an address of 0xEE (0xEF read).

So, which address should i use with wixel i2c librarie ?

(note : i’m still in phase of debugging I2C communications between wixel and bmp180,
so knowing the good address will surely help me)

Thanks.


#5

There are two different ways to represent an I2C address, but they are equivalent by a single shift. This is because the low order bit of the address is the read/write bit.

You need to use either 0xEE or 0x77, depending on which type of software you have. But one of the two will be wrong and will result in “no response”. Consult the documentation.


#6

Ok,

i see know, the 0x77 is the 7 bits format, while 0xEE is the address shifted by the read/write mode.
I should have translated the address in binary to see it.

Thanks.