cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a threshold value

MKS
Associate II

Hi ,

i need to know how to set a threshold value for state machine interrupt, can u explain with an example. precisely means setting the value in the register for wakeup statemachine

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @MKS​ , I'm afraid I've mistaken the formulas. Please consider that as FS we intend +-2g, so in the formula the correct FS valuue is +-2g=4g for the Threshold LSB. So you have to double the previous values I wrote. Sorry and regards

View solution in original post

5 REPLIES 5
Eleon BORLINI
ST Employee

HI @MKS​ , please consider p. 75 of AN3393 for the wake-up FSM description. The threshold value (THRS1_1 (57h) = 55h in the example case, meaning FS/2^8 * 85 = 664mg), is the comparison value that generates an interrupt if the sensor data out exceeds that value and the masks are properly set to detect a particular axis or the overall acceleration resultant. I don't know if I catch your question. Regards

0690X000009YcymQAC.png

MKS
Associate II

Hi @Eleon BORLINI​  thanks for your reply,

i have seen this document and this section specifically, but i want to know how value :(THRS1_1 (57h) = 55h is deprecated as 664mg, i.e. if i want to set threshold of different value, what (eg.300mg) how can i make calculation on register part, can u explain in detail.

Thank You

Eleon BORLINI
ST Employee

​Hi, the calculation is the following:

(1) THS_value (mg) = FullScale/2^8 * THS_value (LSB)

and the reverse is:

(2) THS_value (LSB) = 2^8/FullScale * THS_value (mg)

So, for example, if you want to set 300mg of threshold and you are working with a 2g FS, you should use equation (2) and get 38.4 decimal, meaning 38dec (the nearest integer). In hexadecimal is 26h.

Regards

MKS
Associate II

Hi @Eleon BORLINI​  thanks for your answer but considering p. 80 of AN3393 in the register configuration of freefall threshold register value is 18h(THRS2_1 56h), if i apply your first formula , i am getting 187.5mg but they have mentioned it as 300(Inside tabular column), so what i this value then.

Regards,

Manjunath

Eleon BORLINI
ST Employee

Hi @MKS​ , I'm afraid I've mistaken the formulas. Please consider that as FS we intend +-2g, so in the formula the correct FS valuue is +-2g=4g for the Threshold LSB. So you have to double the previous values I wrote. Sorry and regards