Im currently writing a module for Sparkfuns LSM9DS0 9DOF IMU. The IMU is properly wired and works as expected. After some configuration I try to read 6 Bytes from register OUT_X_L_A (0x28). My code looks like the following:
I2C2.writeTo(ADDR, OUT_X_L_A);
var result = I2C2.readFrom(ADDR, 6);
result is an Int8Array of size 6, but it contains 6 equal values. More specific: its the value from OUT_X_L_A and all other registers (OUT_X_L_A+1, OUT_X_L_A+n) won't be read. Something like [ 13, 13, 13, 13, 13, 13 ] instead of [ 13, 28, 90, 54, 77, 1 ].
I have seen many modules for other I2C devices that work this way, but if I do:
I2C2.writeTo(ADDR, OUT_X_L_A);
var byte1 = I2C2.readFrom(ADDR, 1);
I2C2.writeTo(ADDR, OUT_X_L_A+1);
var byte2 = I2C2.readFrom(ADDR, 1);
...
it works...Does anyone have an advice for me?
Best regards
otbe
EDIT: Im using a espruino pico with 1v80 firmware. The LSM9DS0 should be capable to send multiple bytes.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi everyone,
Im currently writing a module for Sparkfuns LSM9DS0 9DOF IMU. The IMU is properly wired and works as expected. After some configuration I try to read 6 Bytes from register OUT_X_L_A (0x28). My code looks like the following:
result is an Int8Array of size 6, but it contains 6 equal values. More specific: its the value from OUT_X_L_A and all other registers (OUT_X_L_A+1, OUT_X_L_A+n) won't be read. Something like [ 13, 13, 13, 13, 13, 13 ] instead of [ 13, 28, 90, 54, 77, 1 ].
I have seen many modules for other I2C devices that work this way, but if I do:
it works...Does anyone have an advice for me?
Best regards
otbe
EDIT: Im using a espruino pico with 1v80 firmware. The LSM9DS0 should be capable to send multiple bytes.