2015-02-05 12:01 AM
.ExternalClass8B0DBA798B5B4AA8BE4D83498BC56468 p {margin-bottom:0.25cm;line-height:120%;} .ExternalClass8B0DBA798B5B4AA8BE4D83498BC56468 a:link {;}
Hello,
I use the accelerometer LIS331DLH but I have a problem about values.
The MEMS is conect to the card Mbed FRDM-K64F, 3,3V supply and SPI bus communication.
I use this datasheet :
http://www.st.com/web/en/resource/technical/document/datasheet/CD00213470.pdf
and this application notehttp://www.st.com/web/en/resource/technical/document/application_note/CD00215823.pdf
Communication is OK, WHO_I_AM returns 0x32.
In my program, I follow the Start-up sequence and reading data sequence write in application note.
spiWriteByte(0x20,0x27,cs); // CTRL_REG1 0x20
spiWriteByte(0x20,0x27,cs);
spiWriteByte(0x21,0x00,cs); // CTRL_REG2 0x21
spiWriteByte(0x22,0x00,cs); // CTRL_REG3 0x22
spiWriteByte(0x23,0x00,cs); // CTRL_REG4 0x23
spiWriteByte(0x26,0x10,cs); // REFERENCE 0x26
spiWriteByte(0x32,0x00,cs); // INT1_THS 0x32
spiWriteByte(0x33,0x00,cs); // INT1_DUR 0x33
spiWriteByte(0x36,0x00,cs); // INT2_THS 0x36
spiWriteByte(0x37,0x00,cs); // INT2_DUR 0x37
uint8_t regHP_FILTER=spiReadByte(0x25,cs); //read HP_FILTER_RESET (if filter is enabled)
spiWriteByte(0x30,0x00,cs); // INT1_CFG 0x30
spiWriteByte(0x34,0x00,cs); // INT2_CFG 0x34
spiWriteByte(0x24,0x00,cs); // CTRL_REG5 0x24
My problem is that values returns is false
1g, I have :
X_H= 0x00 X_H= 0x40
Y_H=0x00 Y_H=0x10
Z_H=0x13 Z_H=0x20
And applicatin note write :
X_H= 0x00 X_H= 0x00
Y_H=0x00 Y_H=0x00
Z_H=0x40 Z_H=0x00
-1g, I have :
X_H= 0x00 X_H= 0x40
Y_H=0x00 Y_H=0x10
Z_H=0xe9 Z_H=0x20
And applicatin note write :
X_H= 0x00 X_H= 0x00
Y_H=0x00 Y_H=0x00
Z_H=0xC0 Z_H=0x00
Also I must write 2 times in CTRL_REG1 registry to change the mode to ''Normal-mode''
Can you explain to me my mistake. #lis331dlh