GithubHelp home page GithubHelp logo

stmicroelectronics / lsm6dsox-pid Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 8.0 321 KB

lsm6dsox platform independent driver based on Standard C language and compliant with MISRA standard

License: BSD 3-Clause "New" or "Revised" License

HTML 0.64% CSS 9.18% C 90.17%
mems-sensors stmicroelectronics

lsm6dsox-pid's Issues

Can't read LIS3MDL with FIFO from LSM6DSOX

I use LSM6DSOX and LIS3MDL components, nrf52 board and I have achieved reading raw data seperately.

What I haven't been able to make work are the functions lsm6dsox_sh_fifo_lis2mdl or lsm6dsox_sh_lis2mdl from the examples examples/lsm6dsox_sh_fifo_lis2mdl.c and examples/lsm6dsox_sh_lis2mdl.c accordingly, in the attempt of using FIFO and reading data simultaneously.

I have made the appropriate adjustments for LIS2MDL to LIS3MDL functions.

The result is that I get data for accelerometer and gyro but never from magnetometer.
For the first code, it never enters the case LSM6DSOX_SENSORHUB_SLAVE0_TAG where it will read magnetometer data
and in the other code it prints 0 for magnetic data.

I have called lis3mdl_operating_mode_get() function to make sure that the component is not powered down.

Any ideas why this happens? Is the code tested that it works?
If it is better I can share my code too my_code_for_nrf52

lsm6dsox does not build when optimization level is O2

Device part numbers

lsm6dsox, not sure about other sensors

Type of bug

Build error.

Describe the bug

Project does not build if compiler optimization level is O2.

Additional context

I integrated the driver into an ESP-IDF project of mine. The project builds fine if optimization level is Og, but fails to build when trying to build at level O2.

image

Conversion of gyroscope values

The values used to convert the gyroscope readings from int16 to float have inexplicable values.

When calculating the conversion values myself, I get the correct values for the accelerometer, but not so for the gyroscope.

For example:

float_t lsm6dsox_from_fs16_to_mg(int16_t lsb)
{
  return ((float_t)lsb) * 0.488f;
}

Corresponds nicely to 16/32767 * 1000.

But:

float_t lsm6dsox_from_fs1000_to_mdps(int16_t lsb)
{
  return ((float_t)lsb) * 35.0f;
}

Doesn't correspond to 1000/32767 * 1000 , which yields ~30.5.

Why is this so?
Is it a bug or some kind of special conversion factor I'm not aware of?

The values provided in the Code seem to match the examples from the application note though.
e.g. for 250dps like in the application note example, it would result in a range up to 286dps for that scale (which obviously doesn't make much sense from an outside viewpoint).

lsm6dsox_reg.c/lsm6dsox_all_sources_get() - incorrect block register read?

The function lsm6dsox_all_sources_get() seems incorrect wrt the LSM6dSOX datasheet (DS12814 Rev 3 Jan 2019).
It does a block register read of 12 bytes; the bytecpy() assignment of return values is correct for the first 5 (0x1A-0x1E), but the remaining registers should be copied from 0x35-0x3B.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.