LSM9DS1 data loss @952Hz

Hi,

I used Nano 33 BLE Sense to collect the 9-DOF data samples by LSM9DS1.

The I2C data rate is set:

  • _wire->setClock(400000) ;

Gyroscope and accelerometer sample rates are set to 952Hz:

  • writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0xD8);
  • writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xC8);
  • The continuous mode was selected: setContinuousMode()

Magnetic is set as:

  • writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xC8);
  • writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG3_M, 0x00);

It works very well with the deprecated Arduino Mbed OS boards (V1.3.2) without data loss.
image
However, there are some data samples lost if I use Arduino Mbed OS Nano Boards (I tested several versions, including the latest V2.7.2).
image
The register is read when (IMU.accelerationAvailable()) is true. I posted this question here as well but no any response. https://github.com/arduino/ArduinoCore-mbed/issues/400
Any one can help? Many thanks.

I would recommend you have a look at the interrupt and processor priority settings.

If you need some further help, I also recommend you post a short but full example that shows the behavior.

Hi Klaus_K, thank you so much for your kind help. I will have a look at the processor priority settings. Unfortunately, the IMU interrupt pin was not connected on the board. I tried timer interrupt, but it did not work very well because I2C reading was affected in the timer interrupt handler. Many thanks.

If you like a challenge you could have a look at the documentation and try to make use of the EasyDMA for the I2C peripheral.

I guess some process triggers interrupts and takes too long to finish. That is why I recommended to look at the all interrupt settings. It will tell you whether some process uses interrupts you may not be aware off.
Are you using BLE?

@Klaus_K
I developed my own driver for I2C on Arduino Nano BLE, because I detected, that it may take about 1 ms to fetch sensor data with the Arduino libraries based on mbedOS. Because I have my own (cooperative) multi-tasking based on state machines, I do not use libraries with routines consuming more than about 100 us. (By the way, if you use ArduinoBLE, you get delays in loop-calling up to 6 ms.)

But EasyDMA was not the solution for a proper timing (in my I2C routines). I needed to use the direct link of tasks and events (in register SHORTS) to be fast enough for ACK-handling in my interrupt routines.
With my own libraries (for LSM9DS1 and I2C) I have only delays near/below microseconds.
Though till now I only tested measurement speed at 119 Hz with I2C speed of 100 kbit/s.

Many thanks, Klaus_K. Yes, I used BLE as well. The IMU data was reading after BLE connected.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.