Skip to main content
Visitor II
July 17, 2023
Solved

DRDY not returning low on AIS2IH

  • July 17, 2023
  • 2 replies
  • 1466 views

I am using the AIS2IH and polling the DRDY bit of STATUS to see when a new sample is available .  I am using single data (on demand) mode and ODR bit is set.  The spec sheet says that DRDY returns low after the high part of X,Y or Z has been read, but for me DRDY is remaing high.  Maybe I am setting the mode incorrectly, timing soft reset badly?  Thanks.

Code :

SPIwriteOneRegister(CS_SENSOR1, CTRL_2, 0x48);  // soft reset

// Perform a read to Hi x to reset DRDY :
tmp = SPIreadOneRegister(CS_SENSOR1, OUT_X_H);

SPIwriteOneRegister(CS_SENSOR1, CTRL_1, 0x20);  // Select Single data mode

SPIwriteOneRegister(CS_SENSOR1, CTRL_2, 0x08); // Set Block Data Update to 1 

SPIwriteOneRegister(CS_SENSOR1, CTRL_3, 0); // Set SLP_MODE_SEL == 0 to enable active high external trigger line

SPIwriteOneRegister(CS_SENSOR1, CTRL_6, 0x34); // filtering etc

 

    This topic has been closed for replies.
    Best answer by harrisTech

    Thanks I removed the reset and also increased my SPI frequency (it was only 10khz) to 500khz and now it is working!

    2 replies

    Technical Moderator
    July 18, 2023

    Hi @harrisTech ,

    Welcome to ST Community!

    Have you already tried to perform the test without the initial soft reset?

    Visitor II
    July 31, 2023

    Thanks the DRDY now looks to be working but I think I have an issue with setting the data rate etc.  I want a slow 12.5Hz mode, single-shot (low power better but high performance acceptable) and I want to low pass filter my data at ODR/20, I am trying to detect fairly slow movements. The X_L2 and X_L3 bits etc are not low so there must be an issue, also I can poll the data at ~500Hz and see significant sample changes that I should not see with this setup.  My registers are : 

    SPIwriteOneRegister(CS_SENSOR1, CTRL_1, 0x28);
    SPIwriteOneRegister(CS_SENSOR1, CTRL_2, 0x08);
    SPIwriteOneRegister(CS_SENSOR2, CTRL_3, 0);
    SPIwriteOneRegister(CS_SENSOR1, CTRL_6, 0xF4);

    Thanks!

    harrisTechAuthorAnswer
    Visitor II
    July 23, 2023

    Thanks I removed the reset and also increased my SPI frequency (it was only 10khz) to 500khz and now it is working!