Skip to main content
Visitor II
July 9, 2019
Solved

Setting a threshold value

  • July 9, 2019
  • 5 replies
  • 1435 views

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

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    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

    5 replies

    ST Employee
    July 10, 2019

    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

    MKSAuthor
    Visitor II
    July 15, 2019

    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

    ST Employee
    July 15, 2019

    ​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

    MKSAuthor
    Visitor II
    July 18, 2019

    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

    ST Employee
    July 18, 2019

    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