cancel
Showing results for 
Search instead for 
Did you mean: 

How to slow down the data rate from lsm6dso

srao.1
Associate II

hi,

I am using lsm6dso module.

I have configured with 26hz output data rate using accelerometer control register.

I am reading data from fifo registers in lsm6dso.

expected data rate speed : 1/26hz = 38.4615 milli seconds.

Actual data rate speed : Around 100 micro seconds. this is too fast. I need to slow down the data rate. could you please let me know the solution for this.

TEST 1: accelerometer configured with different ODR values and gyroscope configured with 26 HZ output data rate

 TEST 2: accelerometer and gyroscope configured with same output data rate values (ODR )

  

Regards,

Srinivas

7 REPLIES 7
Eleon BORLINI
ST Employee

Hi Srinivas @srao.1​ ,

100us instead of 38.5ms sounds weird...

I'm wondering if you are maybe referring to the bit output rate instead of the x-y-z 16-bit accelerometer pattern rate...

26Hz is the total rate of 6 Bytes (2 Bytes resolution for 3 axes): 38.5ms / 16*3 is 80us, close to 100us...

If however this is not the case, please check if you configured your device in the following way (ref. lsm6dso_read_data_polling.c:(

/* Disable I3C interface */
  lsm6dso_i3c_disable_set(&dev_ctx, LSM6DSO_I3C_DISABLE);
  /* Enable Block Data Update */
  lsm6dso_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
  /* Set Output Data Rate */
  lsm6dso_xl_data_rate_set(&dev_ctx, LSM6DSO_XL_ODR_26Hz); --> CTRL1_XL = 20h
  //lsm6dso_gy_data_rate_set(&dev_ctx, LSM6DSO_GY_ODR_26Hz);
  /* Set full scale */
  lsm6dso_xl_full_scale_set(&dev_ctx, LSM6DSO_2g);
  //lsm6dso_gy_full_scale_set(&dev_ctx, LSM6DSO_2000dps);

Please let me know if you are able to fix your issue. If this answer was useful, please set it as "best" for future users.

-Eleon

srao.1
Associate II

Hi Eleon BORLINI,

Thanks for response. please have the details of my environment and provide solution for slow down the data reading rate

Actually we are reading 7 bytes ( 1 tag byte and x-y-z 16-bit accelerometer pattern ) from fifo.

Is there any formula to calculate total rate based on Accelerometer ODR (output data rate) value?

where can we refer this formula ?

As per given formula, (1/ODR)/16*3 

For the given example of 26hz ODR , we are getting around 800us not 80us as below

(1/26)/16*3 = 38.5ms/48 = 802us

snippet : 

fifo_tag_register = 1<<7 | 0x78;

if(nrf_drv_spi_transfer(&spi, &fifo_tag_register, 1, read_buffer, 7) != NRFX_SUCCESS)  //read data from address 78h to 7Eh

{

  error_code = 2;

}

 

we are calculate timing for the successful if condition

Eleon BORLINI
ST Employee

Hi @srao.1​ ,

I made a mistake in calculation, sorry... I intended that the bit output is about 100us, since in 1 ODR pulse you have 16*8*3(+8 for the tag) bits, leading to almost exactly 100us.

If you want to reduce the bit speed, you can reduce either the ODR in FIFO (e.g. acting on BDR_XL_[3:0]  of FIFO_CTRL3 (09h) register), or reduce the SPI speed.

-Eleon

Hi Eleon BORLINI,

Thanks for immediate response

Regarding calculation : 16*8*3(+8 for the tag) bits

As per my understanding 16 means bits, 3 means 3-axis,

what is *8 ? and what is +8?

please clarify about calculation.

we have set ODR 26hz and BDR 26hz.

Regards,

Srinivas

Hi @srao.1​ ,

it was a calculation on the SPI speed in order to try to get 100us from the calculation.

Can you please share with me the timestamp of the acquired data? I think I don't have enough data to understand the issue, sorry.

Thank you,

Eleon

srao.1
Associate II

Hi Eleon BORLINI,

Please check attached table for more information.

0693W000006F9HeQAK.png

Hi @srao.1​ ,

ok... but are you filling the FIFO up to a certain threshold (for example tag+3 axis values) and then reading the batch of FIFO data all together, right? If so, the speed of the reading depends on the speed of your SPI or I2C, and is uncorrelated with the ODR, because you are reading data already saved in memory. In this case, the 73ms you see are given by 1/(SPI-I2C clock frequency) * (16*3 + 8), the 7 bytes you are reading from the FIFO every time.

Could you also share the read acceleration data (+ tag) that you are reading from the FIFO?

If you want to read at 26Hz (or configured ODR speed), you don't need to go in FIFO mode, but you can just red the output registers in polling mode (lsm6dso_read_data_polling.c) or synchronously with the DRDY interrupt (lsm6dso_read_data_interrupt.c).

-Eleon