Skip to main content
TSchi.2269
Associate III
April 2, 2020
Question

LSM6DSOX Interrupt registered but all mlc_out registers are empty?

  • April 2, 2020
  • 1 reply
  • 1506 views

Hey!

After doing some work I connected a Nucleo-L011K4 to the STEVAL-MKI197V1 breakout sensor board with the LSM6DSOX. I am connected through SPI, loaded the configuration (header file) on it and get it running. I've also set up a GPIO on the Nucleo board that is connected to the INT1 pin of the sensor board and makes an interrupt when the INT1 of the sensor gets high. This all works and the interrupt is called when expected. However, I also want to read the code of the interrupt, which would be 0 or 4 depending on the detected movement.

I use the following code bit

lsm6dsox_all_sources_t status;
uint8_t mlc_out[8];
 
lsm6dsox_all_sources_get(&dev_ctx, &status);
if (status.mlc_status.is_mlc1){
 lsm6dsox_mlc_out_get(&dev_ctx, mlc_out);
 sprintf((char*)tx_buffer, "Detect MLC interrupt code: %02X\r\n",
 mlc_out[0]);
 
 tx_com(tx_buffer, strlen((char const*)tx_buffer));
}

I use this to print out the code, ONLY when I notice the interrupt from INT1.

The problem is, that the interrupt gets detected, and it prints out, but the print code is always 00. What did I do wrong? Also, I tried other registers of mlc_out, but those others also print out 00.

This topic has been closed for replies.

1 reply

Eleon BORLINI
ST Employee
April 2, 2020

Hi @TSchi.2269​ , supposing you are using the decision tree #1, to get the decision tree output you should read the content of MLC0_SRC (70h) register. The MLC_STATUS (15h) contains only the evidence if a change of the detected movement has occurred (e.g. if your decision tree change its output from "stationary" to "walking"). Regards

TSchi.2269
Associate III
April 2, 2020

Thanks @Eleon BORLINI​  for your answer. Yes, I am using decision tree #1. As you can see from my code snippet, I also use:

 lsm6dsox_mlc_out_get(&dev_ctx, mlc_out);

Which, according to the documentation, contains the read content of ML0_SRC:

int32_t lsm6dsox_mlc_out_get(stmdev_ctx_t *ctx, uint8_t *buff)
{
 int32_t ret;
 ret = lsm6dsox_mem_bank_set(ctx, LSM6DSOX_EMBEDDED_FUNC_BANK);
 if (ret == 0) {
 ret = lsm6dsox_read_reg(ctx, LSM6DSOX_MLC0_SRC, buff, 8);
 }
 if (ret == 0) {
 ret = lsm6dsox_mem_bank_set(ctx, LSM6DSOX_USER_BANK);
 }
 return ret;
}

When doing this, I still get 0 as value. Do you know what might be the problem? My code is at LSM6DSOX level exactly the same as the lsm6dsox_STdC\example\machine_learning_core example of STM on Github. Thank you very much for all your hard work. I'm looking forward hearing from you.