2021-04-09 12:39 PM
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.
/* 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));
}
2021-04-12 05:39 AM
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.
2021-04-12 05:52 AM
Hi @Iakgu.1 ,
Let me ask you some questions to better understand your problem:
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ò
2021-04-12 06:30 AM
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
2021-04-12 06:58 AM
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?
2021-04-14 03:54 AM
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
2021-04-14 04:08 AM
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ò