2023-07-17 05:09 AM
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
Solved! Go to Solution.
2023-07-23 02:34 AM
Thanks I removed the reset and also increased my SPI frequency (it was only 10khz) to 500khz and now it is working!
2023-07-18 07:12 AM
Hi @harrisTech ,
Welcome to ST Community!
Have you already tried to perform the test without the initial soft reset?
2023-07-23 02:34 AM
Thanks I removed the reset and also increased my SPI frequency (it was only 10khz) to 500khz and now it is working!
2023-07-31 11:17 AM
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!