Skip to content

LSM6DS3 driver implementation for LimiFrog V1#3263

Closed
ReneHerthel wants to merge 4 commits intoRIOT-OS:masterfrom
ReneHerthel:driver_lsm6ds3
Closed

LSM6DS3 driver implementation for LimiFrog V1#3263
ReneHerthel wants to merge 4 commits intoRIOT-OS:masterfrom
ReneHerthel:driver_lsm6ds3

Conversation

@ReneHerthel
Copy link
Copy Markdown
Contributor

Needed for the port of the board: LimiFrog.

board: RIOT port for LimiFrog V1 #3020

@PeterKietzmann Here's my first implementation for the lsm6ds3 driver, but there are still some TODO's, which I have to handle in the next time..

@PeterKietzmann
Copy link
Copy Markdown
Member

@ReneHerthel nice! I will have a deeper look when you finished your todos. Are there any questions for this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add HAW Hamburg here and let FU Berlin in, as you code seems to base on Thomas Eichingers code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we stay with the (below discussed) decision that you are the only author, please replace FU by HAW

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haukepetersen
Copy link
Copy Markdown
Contributor

Just a side question: How similar are the LSM6DS3 and the LSM303DLHC drivers? Does it make sense to merge them into the same codebase?

@PeterKietzmann
Copy link
Copy Markdown
Member

@ReneHerthel? I don't know about the internals...

@ReneHerthel
Copy link
Copy Markdown
Contributor Author

The LSM6DS3 is a little different as the LSM303DLHC.
There are much more FIFO registers which controlls the output/input data.
I guess the LSM303DLHC handle its sensor datas directly with an address and the digital interface (i2c) and the LSM6DS3 with some FIFO registers (which stores the data of the accelerometer and gyroscope), between the i2c and the accelerometer or gyroscope.

See here:
Page 20, 21, 22 in the LSM303DLHC datasheet:
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00027543.pdf

and:
Page 27_5.4_FIFO in the LSM6DS3 datasheet:
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00133076.pdf

If you want to have an overview..

@OlegHahm OlegHahm added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: drivers Area: Device drivers labels Jun 29, 2015
@PeterKietzmann
Copy link
Copy Markdown
Member

I tend to have separate implementations. Here are just some reasons I found during a quick look in the datasheets:

  • the one sensor contains a gyroscope and the other contains a magnetometer
  • both sensors contain an accelerometer but the one features a low power "always on" mode
  • as @ReneHerthel said, the one sensor has many (relatively great) FIFOs
  • the registers of both sensors don't look too similar

@haukepetersen if you have other opinions please state them as fast as you can!

@ReneHerthel
Copy link
Copy Markdown
Contributor Author

@PeterKietzmann any ideas? did you look at my latest push? :-)

@PeterKietzmann
Copy link
Copy Markdown
Member

@ReneHerthel no I didn't. As long as no message plopps up here I'm not aware of new commits :-) . Will look inside soon. Are there open questions?

@ReneHerthel
Copy link
Copy Markdown
Contributor Author

@PeterKietzmann Ooh, I forgot to tell you... ehm, yes I'm not sure with the FIFO-registers, because the LSM303DLHC has constant addresses to the two sensors, and the LSM6DS3 not, so should I use the address, of the FIFO-output-register, where the data from the sensors are stored? .. I guess this was the only thing i didn't implemented yet..

@PeterKietzmann
Copy link
Copy Markdown
Member

@ReneHerthel if reading from the fifos is the only way to get the measurement data from the sensors, I think there is no way around :-). Or did I get you wrong? I don't know if you're aware of it, or even if it's interesting, but did you see #3054? If you need more help here, please rephrase your question so I can specifically search in the datasheet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this correlate with the fifo stuff you've been explaining?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Then the next question is, do you need these defines? Or as you want to have them in for "template"-reasons, you could add a comment...

@PeterKietzmann
Copy link
Copy Markdown
Member

The driver should be compatible as long as the sensor is connected via I2C (I don't even know if this device supports other bus protocols). Only thing that should need adaption is the pin configuration and probably the slave address. I fear that there might be some relicts that I plan to fix as soon as I have the hardware available. In best case this only concerns the usage of I2C_X macro. Would be great if you can already give it a shot @aabadie!

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jan 16, 2017

@PeterKietzmann, will test, probably tomorrow afternoon

@@ -0,0 +1,48 @@
/*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this file be moved to drivers/lsm6ds3/include so one can use it with the default params and the sensor plugged on another board ?

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jan 19, 2017

Readme.md file missing with the test application.

data->z_axis = raw[2] * sensitivity / GYR_DIVIDER;
}

void lsm6ds3_read_temp(lsm6ds3_t *dev, int16_t *data)
Copy link
Copy Markdown
Contributor

@aabadie aabadie Jan 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be value instead of data here or data below instead of value, otherwise it doesn't build

i2c_read_reg(dev->i2c, dev->addr, LSM6DS3_WHO_AM_I_REG, &tmp);

if (tmp != LSM6DS_CHIP_ID) {
DEBUG("LIS3MDL: Failed to identify sensor\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/LIS3MDL/LSM6DS3/

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jan 19, 2017

Tested on my ST nucleo iks01a1 shield where there's a LSM6DS0. Following the datasheet the ID is 0xD0 and the sensor I2C address 0xD6. In any case, the sensor is not recognize, which is weird.

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jan 19, 2017

I also tried to skip the sensor ID verification and the read values were wrong (empty).


i2c_acquire(dev->i2c);

i2c_init_master(i2c, I2C_SPEED_NORMAL);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should go before i2c_aquire

@PeterKietzmann
Copy link
Copy Markdown
Member

@ReneHerthel please don't take it personally but I'm wondering how you even tested this. (i) Your demo application doesn't even compile and (ii) with compilation errors fixed the application simply hard-faults and reboots the device constantly which might be related to #6432. Btw, I fetched your branch.

When I offered to shepherd this implementation I've assumed there are only minor style fixes left over but this requires more work which I can't provide before the release. I'm sorry.

@PeterKietzmann
Copy link
Copy Markdown
Member

@aabadie in case you are willing to take this over in the context of your board and driver enhancement-mania :-), feel free to do so! Otherwise I will try my best to provide fixes for the limifrog first and this driver after the release. Thanks for the review!

@miri64
Copy link
Copy Markdown
Member

miri64 commented May 23, 2017

Ping?

@smlng
Copy link
Copy Markdown
Member

smlng commented Jun 19, 2017

with #6835 already merged it might be possible to unify these drivers?! A quick look into some of the defines showed that both devices share lots of values.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 5, 2017

Ping again then ;-)

@PeterKietzmann PeterKietzmann added the State: archived State: The PR has been archived for possible future re-adaptation label Nov 21, 2017
@PeterKietzmann
Copy link
Copy Markdown
Member

I see no reason for this PR so stay open. No progress since months or years. #6835 provides a driver for a similar device. Maybe a 'busy bee' will merge both drivers in some time in future. Closing with memo label set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR State: archived State: The PR has been archived for possible future re-adaptation Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants