cancel
Showing results for 
Search instead for 
Did you mean: 

DRDY not returning low on AIS2IH

harrisTech
Associate II

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
harrisTech
Associate II

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

View solution in original post

3 REPLIES 3
Federica Bossi
ST Employee

Hi @harrisTech ,

Welcome to ST Community!

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

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
harrisTech
Associate II

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

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!