cancel
Showing results for 
Search instead for 
Did you mean: 

I have lsm6dso sensor. I am using fsm interrupt for different events. I have 3 programs in fsm. When the event detected, interrupt comes.I gave three fsm program to same interrupt pin. But I want to know which fsm event detected ?

Iakgu.1
Associate III

I have lsm6dso sensor. I am using fsm interrupt for different events. I have 3 programs in fsm. When the event detected, interrupt comes.I gave three fsm program to same interrupt pin. But I want to know which fsm interrupt detected .

When I read the register as given in example , fsm1, fsm2 and fsm3 stays zero. 

Is there another way to know know which fsm has been detected ?

This method is not working. It can detect the event but I cannot distinguish which event happened.

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dso_STdC/example/lsm6dso_fsm.c

 /* Read interrupt source registers in polling mode (no int) */

lsm6dso_all_sources_t   status;

  lsm6dso_all_sources_get(&dev_ctx, &status);

  if (status.fsm1) {

   sprintf((char *)tx_buffer, "glance detected\r\n");

   tx_com(tx_buffer, strlen((char const *)tx_buffer));

  }

  if (status.fsm2) {

   sprintf((char *)tx_buffer, "motion detected\r\n");

   tx_com(tx_buffer, strlen((char const *)tx_buffer));

  }

  if (status.fsm3) {

   sprintf((char *)tx_buffer, "no motion detected\r\n");

   tx_com(tx_buffer, strlen((char const *)tx_buffer));

  }

6 REPLIES 6
Iakgu.1
Associate III

FSM_STATUS_A_MAINPAGE (36h)

The FSM_STATUS_A_MAINPAGE (36h) register contains interrupt status information about programs 1-8.

I also tried to read this register, but still read zero. Although interrupt comes, I can not detect which fsm it is. Since I read zero from register.

I need solution urgently.

niccolò
ST Employee

Hi @Iakgu.1​ ,

Let me ask you some questions to better understand your problem:

  • are you running the example FSM code on your sensor? (I mean the one with 7 possible outcomes)
  • when the interrupt is triggered, what do you do? (I mean in the interrupt handler)
  • just to be sure, is your device configured correctly? (data from the sensor is what you'd expect?)

I'm asking all these question to understand what is the difference between your program and the example to get at your problem, because the example code works fine for me

Niccolò

Iakgu.1
Associate III

1)Yes I am using the example. Example does not work when I tried.

I change only one line in example.

lsm6dso_int_notification_set(&dev_ctx, LSM6DSO_BASE_PULSED_EMB_LATCHED);

I changed to :

lsm6dso_int_notification_set(&dev_ctx, LSM6DSO_ALL_INT_PULSED);

Since when I use the example directly, there is no interrupt.

interrupt comes only when I change this line.

But the problem I mentioned occurs. I can't figure out which fsm was interrupting.

2)I read the all source register as in the example in interrupt handler.

3)yes ı think it is configured correctly, since it passes selftest example that is given in github.

thanks for your prompt reply. @niccolo.ruffini​ 

Hi @Iakgu.1​ ,

can you check register EMB_FUNC_STATUS_MAINPAGE (35h) to be sure that the interrupt that you see is the one from the FSM?

Iakgu.1
Associate III

In application note it is written: "The EMB_FUNC_STATUS_MAINPAGE (35h) register contains interrupt status information about the long

counter." I think this register is unrelated with our topic.

The example worked for me , when i change gpio mode to rising edge trigger detection.

Thanks for your help. @niccolo.ruffini​ 

Hi @Iakgu.1​ ,

yes, you are right, the EMB_FUNC_STATUS_MAINPAGE register should be unrelated with this situation, but I would have checked it to be sure there weren't other interrupts triggered.

Anyway, I'm happy to hear that you found the problem.

Interrupt settings are often difficult to set right.

have a nice day.

Niccolò