cancel
Showing results for 
Search instead for 
Did you mean: 

Doubts about the reconfiguration procedure of the LIS2DUXS12's FSM

GPomp.1
Associate III

Hi support,

I'm using the LIS2DUXS12. I make you a short recap about the use of the LIS2DUXS12 with our prototype:

  • We use 3 FSM:
    • FSM_1: To detect the significant motion;
    • FSM_2: To detetct the no motion;
    • FSM_3: To detect the situation where the acceleration is above a threshold;
  • All the FSM use as input the filter differential of the MLC engine;

In our application we need to change some parameters of the FSM. For example regarding the FSM_2, we should change the threshold or the timer ( we use the timer in order to verify that that samples of the differential filter is under the threshold for a period specified ).

To manage these situations, as I anticipate you in the previous mail, we implement these steps:

  1. Stop the FSM (using the register FSM_ENABLE – 1Ah);
  2. Re-configure some FSM’s parameters;
  3. Restart the FSM (using the register FSM_ENABLE – 1Ah);

To re-configure the FSM’s parameters, we update the FSM’s code; as example, I report you the code that we’re using to update the timer od the FSM2:

int32_t accUpdate_FSM2_TI1(stmdev_ctx_t *ctx, uint16_t value)

{

      int32_t result = IMU_NO_ERROR;

      uint16_t address = ((0x3 << 8) | (0x98));

      uint8_t buff[2];

      do

      {

            buff[1] = (uint8_t)(value / 256U);

            buff[0] = (uint8_t)(value - (buff[1] * 256U));

            result = lis2duxs12_ln_pg_write(ctx, address, (uint8_t *)&buff[0], 2);

            if(result != IMU_NO_ERROR)

                   break;

      }

      while(0);

      return result;

}

I do this recap because during the tests, we’re observing that the FSM after some re-configurations enter in a block state, we don’t receive any interrupts. In your opinion, what ‘s the cause of this strange behaviour? We should change something in the re-configuration procedure?I’ve a dobut perhaps should I stop the FSM and MLC engine before do the reconfiguration procedure?

5 REPLIES 5
Eleon BORLINI
ST Employee

Hi @Community member​ ,

Are you trying to change the Timer1 value? In this case, the best way is to use the FSM commands themselves. Specifically:

  • STIMER3 changes the value for timer 3
  • STIMER4 changes the value for timer 4
  • STHR1 changes the value for threshold 1
  • STHR2 changes the value for threshold 2
  • SETP changes the value of any FSM byte, it is useful in case you want to change the value of the parameters that cannot be changed through dedicated command (STIMER3, STIMER4, STHR1, STHR2), such as for example the timer1 value, as looks in your case.

Please check if this can help.

-Eleon

GPomp.1
Associate III

Hi Eleon,

in our application we need to change some FSM's parameter in run time after the initialization of the FSM.

At the moment, I don't understand how I should translate the command SETP ( or the others which you've mentioned) over the SPI bus.

Assuming that I should execute a command SETP, for me it's not clearly what register of the LIS2DUXS12 I should upgrade. Is it available some C function that implements these command (STEP, STIMER3 , STIMER4.. )?

Could give me some examples?

Regards,

Giampietro

GPomp.1
Associate III

Hi Eleon,

when do you suggest to use the command STIMER3  (or the others commands), are you suggesting to use the Unico Gui Tool?

For example, if I want to change the value for threshold 1 of the FSM2, should I do a configuration like shows the picture in attachment?

0693W00000WLEkwQAH.png 

In this case, following the procedure which generates C code, I should reconfigure the entire accelerometer (in fact the file .h for example contains the reference of the register CTRL5 ), am I right?

If my guess is correct, how could I implement the commad SETP?

Now, in our application, to change the parameter of the FSM I directly change the register after stopped the FSM machine . I've determinate the address from the file .h generate from the Giu Tools. Following this steps, what's the problem?

Regards,

Giampietro

Eleon BORLINI
ST Employee

Hi Giampietro @Community member​ ,

you might start by the user manual of the LSM6DSR FSM for more info about the commands and settings of the Finite State Machine.

-Eleon

GPomp.1
Associate III

Hi Eleon,

many thanks for your support.

I've read the manual and I've a doubs; after changing some parameters ( for example THR1 or TI1 ) using the command SETP, how can I read the new value? Suppose that I have to verify if the update procedure ended without errors.

Giampietro