multi byte i2c with current interface, is it possible?
ypapelis
Posts: 99
I am trying to read a pololum 9 DOF imu (http://www.pololu.com/catalog/product/1264/resources) using the i2c driver in propgcc.
One problem I run into, is that if I use the simple_i2cOpen call, I can't get any devices to respond. The same setup can talk to all three sensors using SPIN so I know that from a hardware standpoint things are intact.
I used instead the i2cOpen, but when the magnetometer requires that six bytes be read in a multi-byte sequence, without resending the start bit. I can't see how I can do this since the i2c interface does not expose the low level start/stop bit functionality (except for specifying if the ack-bit should be set or not).
I have SPIN code that will read the mag fine but I am trying to avoid bit-banging the i2c bus and want to use the built-in driver. Is it possible to do so?
One problem I run into, is that if I use the simple_i2cOpen call, I can't get any devices to respond. The same setup can talk to all three sensors using SPIN so I know that from a hardware standpoint things are intact.
I used instead the i2cOpen, but when the magnetometer requires that six bytes be read in a multi-byte sequence, without resending the start bit. I can't see how I can do this since the i2c interface does not expose the low level start/stop bit functionality (except for specifying if the ack-bit should be set or not).
I have SPIN code that will read the mag fine but I am trying to avoid bit-banging the i2c bus and want to use the built-in driver. Is it possible to do so?
Comments
Thanks Dave, that makes sense; after I posted I realized that I can just stick more bytes in the buffer, specify the size and it should work.
I think the multi-byte works now but I am still not getting correct data from the sensors. Data comes out, but it's not correct.
I was also wondering about the last argument to the i2copen() function, is it the actual data rate (i.e., 400000) or a symbolic constant? It would be great to have some functioning examples with actual devices so some of these things become clear, but i guess all in due time ...
Thanks again !
Here is an example that talks to an ADC chip.
Is it possible to post or point me to examples of c code that uses the i2copen, i2cread, and i2cwrite application program interfaces. I am trying to communicate with the altimeter module MS5607 and compass module 3 axis HMC5883L.
Thanks,
Terry
Thanks alot. With a couple of minor tweeks, that did the trick.
Terry