2014-02-25 06:15 PM
Currently, I am now using LSM330, the only reference driver I found is official Linux-OS driver. Since there's no programming guides, I search website for source code for reference, only to find that all source code I found have a different register definition.
For instance, in a project in github, among the initialization code block, the author wrote the code below:
this
->
setAccelSensitivity
(
accelSensitivity
);
// Check the datasheet (p29)
// Normal (1.344 kHz) / low-power mode (5.376 kHz) data rate
// Normal mode selected (default)
// x,y,z axis enabled (default)
writeRegister
(
chipSelectAccel
,
CTRL_REG1
,
0
b10010111
);
// High-pass filter mode selection : Normal mode (reset reading HP_RESET_FILTER) (default)
// High-pass filter cutoff frequency selection
// Filtered data selection : internal filter bypassed (default)
// High-pass filter enabled for CLICK function : filter bypassed
// High-pass filter enabled for AOI function on interrupt 2 : filter bypassed
// High-pass filter enabled for AOI function on interrupt 1 : filter bypassed
writeRegister
(
chipSelectAccel
,
CTRL_REG2
,
0
b00000000
);
With the definition below:/***************************************************
LSM330 Registers for gyro and accelerometer
****************************************************/
#define WHO_AM_I 0x0F
#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define CTRL_REG3 0x22
#define CTRL_REG4 0x23
#define CTRL_REG5 0x24
#define CTRL_REG6 0x25
#define REFERENCE_A 0x26
#define REFERENCE 0x25
#define OUT_TEMP 0x26
#define STATUS_REG 0x27
#define OUT_X_L 0x28
#define OUT_X_H 0x29
#define OUT_Y_L 0x2A
#define OUT_Y_H 0x2B
#define OUT_Z_L 0x2C
#define OUT_Z_H 0x2D
#define FIFO_CTRL_REG 0x2E
#define FIFO_SRC_REG 0x2F
#define INT1_CFG 0x30
#define INT1_SRC 0x31
#define INT1_TSH_XH 0x32
#define INT1_TSH_XL 0x33
#define INT1_TSH_YH 0x34
#define INT1_TSH_YL 0x35
#define INT1_TSH_ZH 0x36
#define INT1_TSH_ZL 0x37
#define INT1_DURATION 0x38
However, in LSM330 official datasheet, the accelerate motion sensor has no CTRL_REG1, and from the content, we can see that the author disable HPF for ACCEL, where's ACCEL-HPF??? Only gyroscope has two LPF and one HPF.Anyone please help me understand this? Thanks very much.2016-12-13 06:52 AM
Hi Wancheng,
I have trouble to read data from LSM330TR too. Have you found anything to solve the problem?