cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303D data synchronization

trav
Associate
Posted on January 13, 2014 at 18:35

All the example code I've seen reads the acceleration and magnetic field values by polling the appropriate registers.

For example:

x.l = i2c_read(OUT_X_L_A);

x.h = i2c_read(OUT_X_H_A);

y.l = i2c_read(OUT_Y_L_A);

y.h = i2c_read(OUT_Y_H_A);

z.l = i2c_read(OUT_Z_L_A);

z.h = i2c_read(OUT_Z_H_A);

When does the sensor update the register values? How do I know when to read the registers?

I am concerned that the chip could update the register value between polling the OUT_X_L_A and OUT_X_L_H, resulting in a corrupt reading.

Thanks,

Travis
1 REPLY 1
Thiago REIS
Associate II
Posted on January 17, 2014 at 14:10

Hello Travis,

In order to avoid an issue like this, please check on the attached datasheet the following parameters:

CTRL1 (20h) - BDU Parameter

BDU Block data update for acceleration and magnetic data. Default value: 0 (0: continuous update; 1: output registers not updated until MSB and LSB have been read).

Thank you very much,

Thiago

________________

Attachments :

LSM303D.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzK9&d=%2Fa%2F0X0000000bJw%2FWpOSuxJO1H6JbZF_3ewf.JwN7UXXoGsuq.Zrlz7CRQY&asPdf=false