cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSV320X Burst Read Issues

viggyd-blur
Visitor

Summary

Our eventual product will use the LSM6DSV320X but right now, all we have is an LSM6DSV80X chip on the STEVAL-MK1247A breakout board. The products are close enough that I can test on the 80X. I am currently trying to implement the burst read feature of the chip. I am having two main problems when doing the burst read:

1. After some time, I am getting tags in the FIFO for parts of the sensor I have not enabled (e.g. I get a temperature tag despite not having enabled temperature batching)

2. For some reason, my INT1 pin is triggering even though the FIFO watermark is not met.

 

Platform

Board: Nordic nrf52840-dk

OS: Zephyr RTOS (nRF Connect SDK v3.2.0)

Sensor: LSM6DSV80X on the STEVAL-MK1247A -- SPI Clock at 8 MHz

 

Background

In Section 9.8 of AN6119 it describes how to retrieve data from the FIFO and there are two methods provided:

1. Read the FIFO_STATUS1 and FIFO_STATUS2 registers to check how many words are stored in the FIFO.
This information is contained in the DIFF_FIFO_[8:0] field.
2. For each word in FIFO, read the FIFO word (tag and output data) and interpret it on the basis of the FIFO tag.
3. Go to step 1.

This is how my code was set up previously and I got correct data from the chip. The only problem with this method is that it's too slow. We plan to use 2 or 3 of these accelerometers in our application and it was taking me up to 8 ms to read data from the FIFO using this method, which is too long.

The other method described is this:

 1. Read the FIFO_STATUS1 and FIFO_STATUS2 registers to check how many words are stored in the FIFO.
This information is contained in the DIFF_FIFO_[8:0] field.
2. Read DIFF_FIFO + N words with a multiple operation (that is, (DIFF_FIFO + N) * 7 bytes), where N is chosen
in order to make sure that the FIFO has been emptied.
3. If the data read from the FIFO do not contain data marked with the empty tag, then read N additional samples
in order to empty the FIFO.

 

Setup Code

My code is set up with all 3 sensors at the 960 ODR/batch rate. Here's my setup code using the provided driver:

/* Perform device power-on-reset */
lsm6dsv320x_sw_por(&device->dev_ctx);

/* Enable Block Data Update */
lsm6dsv320x_block_data_update_set(&device->dev_ctx, PROPERTY_ENABLE);

/*
* Set FIFO watermark (number of unread sensor data TAG + 6 bytes
* stored in FIFO) to FIFO_WATERMARK samples
*/
lsm6dsv320x_fifo_watermark_set(&device->dev_ctx, 102);

/* Accelerometer/Gyro are in high performance mode by default */
lsm6dsv320x_driver_configure_sensor(&device->dev_ctx, device->xl_lg_cfg);
lsm6dsv320x_driver_configure_sensor(&device->dev_ctx, device->xl_hg_cfg);
lsm6dsv320x_driver_configure_sensor(&device->dev_ctx, device->gy_cfg);

/* Set FIFO mode to Stream mode (aka Continuous Mode) */
lsm6dsv320x_fifo_mode_set(&device->dev_ctx, LSM6DSV320X_STREAM_MODE);

/* Perform timestamp batching */
lsm6dsv320x_fifo_timestamp_batch_set(&device->dev_ctx, LSM6DSV320X_TMSTMP_DEC_1);
lsm6dsv320x_timestamp_set(&device->dev_ctx, PROPERTY_ENABLE);
synchronize_clocks(device);

/* Configure filtering chain */
filt_settling_mask.drdy = PROPERTY_ENABLE;
filt_settling_mask.irq_xl = PROPERTY_ENABLE;
filt_settling_mask.irq_g = PROPERTY_ENABLE;
lsm6dsv320x_filt_settling_mask_set(&device->dev_ctx, filt_settling_mask);
lsm6dsv320x_filt_gy_lp1_set(&device->dev_ctx, PROPERTY_ENABLE);
lsm6dsv320x_filt_gy_lp1_bandwidth_set(&device->dev_ctx, LSM6DSV320X_GY_ULTRA_LIGHT);
lsm6dsv320x_filt_xl_lp2_set(&device->dev_ctx, PROPERTY_ENABLE);
lsm6dsv320x_filt_xl_lp2_bandwidth_set(&device->dev_ctx, LSM6DSV320X_XL_STRONG);

/* enable fifo_th on High-G XL (sensor at highest frequency) */
pin_int.fifo_th = PROPERTY_ENABLE;
lsm6dsv320x_pin_int1_route_set(&device->dev_ctx, &pin_int);

 

Additional Information

Here's a log of the tag counts that I collected:

[00:00:00.902,343] <inf> lsm6dsv320x: 0x01: 536
[00:00:00.902,343] <inf> lsm6dsv320x: 0x02: 549
[00:00:00.902,374] <inf> lsm6dsv320x: 0x04: 537
[00:00:00.902,374] <inf> lsm6dsv320x: 0x0e: 2
[00:00:00.902,374] <inf> lsm6dsv320x: 0x10: 1
[00:00:00.902,404] <inf> lsm6dsv320x: 0x13: 1
[00:00:00.902,404] <inf> lsm6dsv320x: 0x1a: 1
[00:00:00.902,435] <inf> lsm6dsv320x: 0x1c: 1
[00:00:00.902,435] <inf> lsm6dsv320x: 0x1d: 546

I'm only expecting tags for `0x01`, `0x02`, `0x04`, and `0x1D` (XL LG, XL HG, GY, and Timestamp). As you can see, I'm getting tags for other things too, which is unexpected. I only see this error behavior after about 20 or so burst reads, so the first few are fine. I'm not sure what's going on at this point that causes the error condition.

 

Additionally, here's a screenshot of my reading of the FIFO_STATUS register. As I mentioned, my watermark is set to 102 (0x66), but the register is showing 0x65. Note also that the FIFO_WTM_IA bit is not set. So why did my INT1 trigger?

viggydblur_0-1769783423238.png

 

Final note: I do have an LSM6DSV320X on order and it should be here soon. I'll test with that too, but I don't really expect the results to be any different.

 

EDIT:

It looks like the error conditions happens after I read ~2k words from the FIFO. Sometimes I see the error after 1900 samples, sometimes after 2100, but it's around that region. I'm not sure if that's relevant or not though. The size of my burst read doesn't seem to matter. Once it gets in this region of samples read, I start seeing issues

0 REPLIES 0