cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DH read data not reasonable?

capture
Associate

Hi

I'm currently implementing a crash detector in our device. And it works quite fine, but I think the received values are not correct.

The sensor is on a PCB which is already delivered and should be enabled as a new feature in the future. So they developer has only connected one interrupt.

This is my init code:

  //clear all registers

   resetAllRegisters();

   // 400Hz, all axis enabled

   writeRegister(CTRL_REG1_ADDRESS , CTRL_REG1_ODR2 | CTRL_REG1_ODR1 | CTRL_REG1_ODR0 | CTRL_REG1_ZEN | CTRL_REG1_YEN | CTRL_REG1_XEN);

   // Fitlered data sent to FIFO and outputregister, highpass filter on interrupt 1

   writeRegister(CTRL_REG2_ADDRESS , CTRL_REG2_FDS | CTRL_REG2_HP_IA1);

   // IA1 interrupt on INT1

   writeRegister(CTRL_REG3_ADDRESS , CTRL_REG3_I1_IA1);

   // Block data update, +-8G   ,HighRes

   writeRegister(CTRL_REG4_ADDRESS , CTRL_REG4_BDU | CTRL_REG4_FS1 |CTRL_REG4_HR);

   // Threshold at 8*0.63mg/LSB = 0.504g

   writeRegister(INT1_THS_ADDRESS , 0x08); //1C = 28*63mg/LSB = 1.764g threshold

   //currently no duration set! calculation: registerValue/400Hz = minimal duration for interrupt

   writeRegister(INT1_DURATION_ADDRESS , CLEAR_REGISTER);

   // enable interrupt on x,y,z high

   writeRegister(INT1_CFG_ADDRESS , INT1_CFG_YHIE | INT1_CFG_XHIE | INT1_CFG_ZHIE);

   // enable FIFO

   writeRegister(CTRL_REG5_ADDRESS , CTRL_REG5_FIFO_EN);

   // stream-to-fifo mode enabled

   writeRegister(FIFO_CTRL_REG_ADDRESS , FIFO_CTRL_REG_FM1 | FIFO_CTRL_REG_FM0);

   //clear reference register

   readRegister(REFERENCE_ADDRESS);

As one of the axis will pass the threshold and the interrupt occurs, I do read the FIFO the first time and reconfigure the INT1 from IA1 to FIFO overrun. Then I do capture the FIFO another 6 times to get samples from about half a second. After that I do set the interrupt back to IA1.

This seems to work, but when I do evaluate the captured signals it makes no sense. When I drive into a wall, I do get the highest impact on the Z axis and the others are just oscillating a bit. I also think the resolution on the Z axis is higher.

The other example that I have attached is from an emergeny stop.

Could you help me with my settings or my whole setup? Did i miss something?

Kind Regards

Mario

1 REPLY 1
capture
Associate

Any idea? :)