Best Answer TheIceManProgrammeth, 21 February 2015 - 11:02 PM
I had the same issue. Try amending:
byte write = { AddressOfFirstRegisterIneed };
to
byte write = { AddressOfFirstRegisterIneed | (1 << 7) };
Go to the full post
  | |||||||||||||||||||||||||||
I2C on original netduino not reading multiple bytes
Started by h3mp, Feb 17 2015 10:21 PM
I2C LSM9DS0
Best Answer TheIceManProgrammeth, 21 February 2015 - 11:02 PM
I had the same issue. Try amending:
byte write = { AddressOfFirstRegisterIneed };
to
byte write = { AddressOfFirstRegisterIneed | (1 << 7) }; Go to the full post
3 replies to this topic
#1Posted 17 February 2015 - 10:21 PM I'm new to I2C so apologies in advance
I'm trying to read multiple registers at once from a LSM9DS0 accelerometer/gyro/compass chip..
Each sensor has 6 registers in a row that return X/Y/Z high and low bytes.. so i should be able to use the I2C_ADDRESS of the chip's XM sensor, then point a 'read' at the first of the 6 registers then i was hoping that would return an array of that register plus the next 5..
I use code based on this following example i found on the web: I2CDevice.Configuration config = new I2CDevice.Configuration(I2C_ADDRESS, I2C_CLOCK_RATE_KHZ);
..what i get back is an array of bytes all containing the same value!? (there should be 6 distinct values returned).
if i do 6 separate transactions one after another reading just 1 byte, then i can return all 6 registers successfully..
but as they are all in a row should i not be able to do all this in one transaction?
(i'm doing this on my old Netduino 1 that is probably running 4.2.0 update1 as i didnt have any newer netduinos in my office today)
#2Posted 21 February 2015 - 07:58 PM You'd need special I2C methods that support repeated-start condition, as described in http://forums.netdui...rt-bit-support/ #3Posted 21 February 2015 - 11:02 PM Best Answer I had the same issue. Try amending:
byte write = { AddressOfFirstRegisterIneed };
to
byte write = { AddressOfFirstRegisterIneed | (1 << 7) }; #4Posted 22 February 2015 - 01:38 PM Thanks IceMan..
I had missed that in the datasheet.. it states:
so or'ing in the MSB 1 works great thanks Also tagged with one or more of these keywords: I2C, LSM9DS0
0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | |||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | |||||||||||||||||||||||||||