cancel
Showing results for 
Search instead for 
Did you mean: 

Q-1. This is regarding AIS328DQ, how to set threshold value in INT1_THS. in application note they set 350mg and in register it is 0x16. how they claculated 0x16. Q-2 What is the use of High pass cutt off frequency and how to selectt it.

gb00
Associate II

Q-1. This is regarding AIS328DQ, how to set threshold value in INT1_THS. in application note they set 350mg and in register it is 0x16. how they claculated 0x16. Q-2 What is the use of High pass cutt off frequency and how to selectt it.

4 REPLIES 4
Eleon BORLINI
ST Employee

Hi @gb00​ , consider that the threshold value is an integer on 7bits, and depends on the FS: in case of FS=2g, the maximum threshold will be 2g, so the threshold LSB will be 2g/2^7 = 15.6mg. When you set the INT1_THS = 0x16, this means to have a 15.6mg*22dec = 350mg, almost. 22dec (0x16) is the nearest bit step to get a threshold closest to 350mg. Regards.

​Thanks Eleon. its really helpful. I want to use this IC to detect left ,right movement, ad also I want to detect negative and positive acceleration,  how I can use all this in one application using interrupt.   

You're welcome, @gb00​ . What I suggest you is to use the 4D/6D (INT1_CFG (30h) register for the setting, INT1_SRC (31h) for the polling). You will be able to detect the following positions:

0690X000009YT6lQAG.png

0690X000009YT6qQAG.png

Do this embedded feature match you purpose?​ Regards

gb00
Associate II

​Hi, Thanks for reply. Actually I want to detect acceleration w r t left, right and front (+Ve acceleration) and back( -ve Acceleration). Not position.

I have another question, I have below code. I have set registers for +/-8g, 50Hz, little endian. after reading data I am converting into decimal with multiplying 3.91 scaling factor. for negative number only I taking 2's complement and after that multiplying scaling factor. I am expecting values should near about when I keep device on table at top side = x= 0, y= 0, z = 1g, at bottom side = x= 0, y= 0, z = -1g, 

PFA

But I am getting different . below are the raw values and converted values. is there I need to set offset or need to do self test?

My Code

        // ODR = 50 Hz

2. Write 35h in CTRL_REG2  // High-pass filter enabled on data and interrupt1, HPc=16, Reference signal for filtering, HPen1;

3. Write 00h in CTRL_REG3  // Not Latched interrupt 1and 2, active high on INT1 and 2, 0: push-pull

4. Write 30h in CTRL_REG4  // FS = ±8 g, 0: self-test plus, 0: data LSb @ lower address, 0: continuous update,

        // 0: self-test disabled (bit pos 2), 0: 4-wire interface (Note: we need to ask it.)

5. Write 00h in CTRL_REG5  // Sleep-to-wake disabled

6. Write 06h in INT1_THS  // Threshold = 250 mg   8g/2^7 == 8g/127 = 62.9mg. for 350mg, 350mg/62.9mg = 5.5 (6value)

7. Write 03h in INT1_DURATION  // Duration = 3. ODR is 50Hz, 3/DR = 3/50 ~= 60 ms 

8. Write 06h in REFERENCE (26h) // Threshold = 250 mg   8g/2^7 == 8g/127 = 62.9mg. for 350mg, 350mg/62.9mg = 5.5 (6value)

        // 0x10 for 1000mg

9. Write 0Ah in INT1_CFG  // Configure desired wake-up event, OR combination of interrupt events, High event YHIE ,XHIE

12. Write 05h in INT2_CFG  // Configure desired wake-up event, OR combination of interrupt events, Low event YLIE ,XLIE

11. Write 03h in INT2_DURATION // Duration = 3. ODR is 50Hz, 3/DR = 3/50 ~= 60 ms 

12. Write 05h in INT2_CFG  // Configure desired wake-up event, OR combination of interrupt events, Low event YLIE ,XLIE