2022-12-15 01:13 AM
Hi support,
I'm using the LIS2DUXS12. I make you a short recap about the use of the LIS2DUXS12 with our prototype:
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:
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?
2022-12-16 08:29 AM
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:
Please check if this can help.
-Eleon
2022-12-16 10:00 AM
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
2022-12-17 02:41 AM
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?
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
2022-12-22 07:35 AM
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
2022-12-27 02:01 AM
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