public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jimmy Assarsson <jimmyassarsson@gmail.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-iio@vger.kernel.org
Subject: Re: Use LIS3MDL with LSM6DSM sensor-hub
Date: Mon, 23 Mar 2020 16:21:49 +0100	[thread overview]
Message-ID: <37e50d0e-0618-eeba-8cf9-7c1272097a62@gmail.com> (raw)
In-Reply-To: <20200319204937.GB1564882@lore-desk-wlan>

On 2020-03-19 21:49, Lorenzo Bianconi wrote:
>> On 2020-03-19 18:40, Lorenzo Bianconi wrote:
>>>> On 2020-03-14 13:43, Lorenzo Bianconi wrote:
>>>>> On Mar 11, Jimmy Assarsson wrote:
>>>>>> Hi,
>>>>>>
> 
> [...]
> 
>>>>> Hi Jimmy,
>>>>>
>>>>> in order to set the full scale on LIS3MDL you can try the following patch (just
>>>>> compiled, not tested)
>>>>>
>>>>> Regards,
>>>>> Lorenzo
>>>>
>>>> Hi Lorenzo,
>>>>
>>>> Sorry for the late response and thanks for the patch!
>>>
>>> Hi Jimmy,
>>>
>>> ok, I will post the patch, thx for testing.
>>
>> Great, you can add
>> Tested-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
>>
>>>> The patches seems to work.
>>>> Are there any specific tests that we should carry out?
>>>> Via the sysfs interface, we've tested reading raw values of each channel and
>>>> configuring ODR and full scale.
>>>
>>> you can try to enable batching in the hw FIFO doing something like:
>>>
>>> $echo 1 > /sys/bus/iio/devices/<iio-magn>/scan_elements/in_magn_x_en
>>> $echo 1 > /sys/bus/iio/devices/<iio-magn>/scan_elements/in_magn_y_en
>>> $echo 1 > /sys/bus/iio/devices/<iio-magn>/scan_elements/in_magn_z_en
>>> $echo 1 > /sys/bus/iio/devices/<iio-magn>/scan_elements/in_timestamp_en
>>>
>>> $watermark=64
>>> $echo $((2*watermark)) > /sys/bus/iio/devices/<iio-magn>/buffer/length
>>> $echo $watermark > /sys/bus/iio/devices/<iio-magn>/buffer/watermark
>>>
>>> $generic_buffer -gn lsm6dsm_magn -c <# of samples>
>>
>> Ok. I don't got any scan_elements nor buffer directory, for any of the devices.
>> I guess it is not possible to use the FIFO without configuring any interrupt?
>> We got the following dts:
>> &spi1 {
>> 	#address-cells = <1>;
>> 	#size-cells = <0>;
>> 	lsm6dsm@0 {
>> 		compatible = "st,lsm6dsm";
>> 		reg = <0x0>;
>>
>> 		spi-max-frequency = <500000>;
>> 		st,pullups = "true";
> 
> yes, you need to provide the interrupt line doing something like (this is from
> the dts on my rpi):
> 
> 	lsm6dsm@0 {
> 		...
> 		interrupt-parent = <&gpio>;
> 		interrupts = <21 0x4>;
> 		...
> 	};
> 
>> 	};
>> };
>>
>> I'll look into this tomorrow or in the beginning of next week, thanks for the help.

Now I've tested this. It looks fine, except for the very first sample:
$ ./iio_generic_buffer -gn lsm6dsm_magn -c 1
iio device number being used is 3
trigger-less mode selected
-3.250836 -2.796192 10.212408 1584976428879020199
1.893036 2.343738 -0.853224 1584976428917070199
1.888218 2.343300 -0.852786 1584976428955095199
1.888218 2.343300 -0.852786 1584976428993145199
1.889532 2.345490 -0.851472 1584976429031170199

Is this expected?

Regards,
jimmy

  reply	other threads:[~2020-03-23 15:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 20:50 Use LIS3MDL with LSM6DSM sensor-hub Jimmy Assarsson
2020-03-12  8:51 ` Lorenzo Bianconi
2020-03-14 12:43 ` Lorenzo Bianconi
2020-03-19 14:41   ` Jimmy Assarsson
2020-03-19 17:40     ` Lorenzo Bianconi
2020-03-19 18:45       ` Jimmy Assarsson
2020-03-19 20:49         ` Lorenzo Bianconi
2020-03-23 15:21           ` Jimmy Assarsson [this message]
2020-03-24  8:20             ` Lorenzo Bianconi
2020-03-24 13:47               ` Jimmy Assarsson
2020-03-24 14:09                 ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37e50d0e-0618-eeba-8cf9-7c1272097a62@gmail.com \
    --to=jimmyassarsson@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox