* Trigger (drdy) on st-sensor lis331dlh - how to question
@ 2014-09-23 16:01 Branko Karaklajic
2014-09-23 16:12 ` Denis CIOCCA
0 siblings, 1 reply; 3+ messages in thread
From: Branko Karaklajic @ 2014-09-23 16:01 UTC (permalink / raw)
To: linux-iio
Hi to everyone,
This question is a bit long, but please bear with me for a moment, as
we need your help to understand if we are doing something wrong (first
time IIO usage on our side).
We are working on project with SAMA5D3 board and accelerometer
(lis331dlh) sensor and linux 3.17-rc5. We successfully connected
lis331dlh to board via SPI interface, and we are able to read sensor
through spidev and also through IIO interface by reading raw values.
But there is a problem with IIO buffer, as we are not able to get any
data through buffer.
Our understanding is that we should define interrupt which will be
triggered outside (by sensor data-ready-int output), and this
interrupt will trigger IIO to read data and store it to buffer.
Sensor <data ready> output is connected to Port D, pin 21 of CPU, and
device tree looks like:
spi1: spi@f8008000 {
cs-gpios = <&pioC 25 0>;
status = "okay";
lis331dlh@0 {
compatible = "st,lis331dlh-accel";
spi-max-frequency = <10000000>;
reg = <0>;
interrupt-parent = <&pioD>;
interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
st,drdy-int-pin = <1>;
};
};
and on boot up we got these messages:
st-accel-spi spi32765.0: st_sensors_of_spi_probe() - lis331dlh.
iio iio:device0: st_sensors_check_device_support() - lis331dlh.
iio iio:device0: st_sensors_init_sensor().
iio iio:device0: st_sensors_set_drdy_int_pin() - drdy_int_pin=1.
iio iio:device0: st_accel_allocate_ring()
iio iio:device0: st_accel_common_probe() - irq: 172.
iio iio:device0: registered accelerometer lis331dlh
As you can see, accelerometer is succesfully registered, and we are
able to read raw data with:
$ cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
this is how our directory looks like:
$ ls -al /sys/bus/iio/devices/
lrwxrwxrwx 1 root root 0 Jan 1 00:17 iio:device0
-> ../../../devices/ahb/ahb:apb/f8008000.spi/spi_master/spi32765/spi32765.0/iio:device0
lrwxrwxrwx 1 root root 0 Jan 1 00:17 trigger0 ->
../../../devices/ahb/ahb:apb/f8008000.spi/spi_master/spi32765/spi32765.0/trigger0
So trigger is also registred with name lis331dlh-trigger.
dmsg line:
...
iio iio:device0: st_accel_common_probe() - irq: 172.
...
indicates that irq 172 (which is IRQ for Port D, pin 21) is registered
(which is also checked in /proc/irq).
So, with all this set, we are not successful to get data from buffer.
Our first guess is to use generic_buffer.c, which we successfully
tried on internal ADC, but there is no data in buffer.
Steps we are using are:
Enable channel in_accel_x_en in iio:device0/scan_elements
Write <lis331dlh-trigger> in iio:device0/trigger/current_trigger
Write length of 16 in iio:device0/buffer/length
Write 1 in iio:device0/buffer/enable
That should be enough to get data into buffer by driver and than to
read it from buffer. Is that true? Did we missed something.
>From HW point of view, we could see transition on interrupt pin when
we enable buffer, but no reading of data.
Our understanding is that function <irqreturn_t
st_sensors_trigger_handler(int irq, void *p)> from file
linux/drivers/iio/common/st_sensors/st_sensors_buffer.c should be
called when interrupt is generated. Is this assumption correct? In our
case it's never called.
Thanks in advance
Branko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Trigger (drdy) on st-sensor lis331dlh - how to question
2014-09-23 16:01 Trigger (drdy) on st-sensor lis331dlh - how to question Branko Karaklajic
@ 2014-09-23 16:12 ` Denis CIOCCA
2014-09-23 16:45 ` Branko Karaklajic
0 siblings, 1 reply; 3+ messages in thread
From: Denis CIOCCA @ 2014-09-23 16:12 UTC (permalink / raw)
To: Branko Karaklajic, linux-iio@vger.kernel.org
SGkgQnJhbmtvLA0KDQpJdCBzZWVtcyB0aGUgcHJvYmxlbSBpcyByZWxhdGVkIHRvIHRoZSBncGlv
IGNvbmZpZ3VyYXRpb24uDQoNCj4gU2Vuc29yIDxkYXRhIHJlYWR5PiBvdXRwdXQgaXMgY29ubmVj
dGVkIHRvIFBvcnQgRCwgcGluIDIxIG9mIENQVSwgYW5kDQo+IGRldmljZSB0cmVlIGxvb2tzIGxp
a2U6DQo+DQo+IHNwaTE6IHNwaUBmODAwODAwMCB7DQo+ICAgIGNzLWdwaW9zID0gPCZwa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Bi
dWZmZXIsIGJ1dCBubyByZWFkaW5nIG9mIGRhdGEuDQo+DQo+IE91ciB1bmRlcnN0YW5kaW5nIGlz
IHRoYXQgZnVuY3Rpb24gPGlycXJldHVybl90DQo+IHN0X3NlbnNvcnNfdHJpZ2dlcl9oYW5kbGVy
KGludCBpcnEsIHZvaWQgKnApPiBmcm9tIGZpbGUNCj4gbGludXgvZHJpdmVycy9paW8vY29tbW9u
L3N0X3NlbnNvcnMvc3Rfc2Vuc29yc19idWZmZXIuYyBzaG91bGQgYmUNCj4gY2FsbGVkIHdoZW4g
aW50ZXJydXB0IGlzIGdlbmVyYXRlZC4gSXMgdGhpcyBhc3N1bXB0aW9uIGNvcnJlY3Q/IEluIG91
cg0KPiBjYXNlIGl0J3MgbmV2ZXIgY2FsbGVkLg0KPg0KPiBUaGFua3MgaW4gYWR2YW5jZQ0KPiBC
cmFua28NCj4gLS0NCj4gVG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQgdGhlIGxp
bmUgInVuc3Vic2NyaWJlIGxpbnV4LWlpbyIgaW4NCj4gdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRv
IG1ham9yZG9tb0B2Z2VyLmtlcm5lbC5vcmcNCj4gTW9yZSBtYWpvcmRvbW8gaW5mbyBhdCAgaHR0
cDovL3ZnZXIua2VybmVsLm9yZy9tYWpvcmRvbW8taW5mby5odG1sDQo=
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Trigger (drdy) on st-sensor lis331dlh - how to question
2014-09-23 16:12 ` Denis CIOCCA
@ 2014-09-23 16:45 ` Branko Karaklajic
0 siblings, 0 replies; 3+ messages in thread
From: Branko Karaklajic @ 2014-09-23 16:45 UTC (permalink / raw)
To: Denis CIOCCA; +Cc: linux-iio@vger.kernel.org
Hi Denis,
thanks for fast response. I forget to say that we tried with all
possible configurations on interrupt. So, no luck with any setting. No
bump on irq handler at all.
Branko
On 23 September 2014 18:12, Denis CIOCCA <denis.ciocca@st.com> wrote:
> Hi Branko,
>
> It seems the problem is related to the gpio configuration.
>
>> Sensor <data ready> output is connected to Port D, pin 21 of CPU, and
>> device tree looks like:
>>
>> spi1: spi@f8008000 {
>> cs-gpios = <&pioC 25 0>;
>> status = "okay";
>>
>> lis331dlh@0 {
>> compatible = "st,lis331dlh-accel";
>> spi-max-frequency = <10000000>;
>> reg = <0>;
>> interrupt-parent = <&pioD>;
>> interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
> interrupts = <21 0x0>;
>
> The IRQ is used in RISING.
>> st,drdy-int-pin = <1>;
>> };
>> };
>
> BR,
> Denis
>
>
>
>> and on boot up we got these messages:
>>
>> st-accel-spi spi32765.0: st_sensors_of_spi_probe() - lis331dlh.
>> iio iio:device0: st_sensors_check_device_support() - lis331dlh.
>> iio iio:device0: st_sensors_init_sensor().
>> iio iio:device0: st_sensors_set_drdy_int_pin() - drdy_int_pin=1.
>> iio iio:device0: st_accel_allocate_ring()
>> iio iio:device0: st_accel_common_probe() - irq: 172.
>> iio iio:device0: registered accelerometer lis331dlh
>>
>> As you can see, accelerometer is succesfully registered, and we are
>> able to read raw data with:
>>
>> $ cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
>>
>> this is how our directory looks like:
>> $ ls -al /sys/bus/iio/devices/
>> lrwxrwxrwx 1 root root 0 Jan 1 00:17 iio:device0
>> -> ../../../devices/ahb/ahb:apb/f8008000.spi/spi_master/spi32765/spi32765.0/iio:device0
>> lrwxrwxrwx 1 root root 0 Jan 1 00:17 trigger0 ->
>> ../../../devices/ahb/ahb:apb/f8008000.spi/spi_master/spi32765/spi32765.0/trigger0
>>
>> So trigger is also registred with name lis331dlh-trigger.
>>
>> dmsg line:
>> ...
>> iio iio:device0: st_accel_common_probe() - irq: 172.
>> ...
>> indicates that irq 172 (which is IRQ for Port D, pin 21) is registered
>> (which is also checked in /proc/irq).
>>
>> So, with all this set, we are not successful to get data from buffer.
>> Our first guess is to use generic_buffer.c, which we successfully
>> tried on internal ADC, but there is no data in buffer.
>>
>> Steps we are using are:
>> Enable channel in_accel_x_en in iio:device0/scan_elements
>> Write <lis331dlh-trigger> in iio:device0/trigger/current_trigger
>> Write length of 16 in iio:device0/buffer/length
>> Write 1 in iio:device0/buffer/enable
>>
>> That should be enough to get data into buffer by driver and than to
>> read it from buffer. Is that true? Did we missed something.
>>
>> From HW point of view, we could see transition on interrupt pin when
>> we enable buffer, but no reading of data.
>>
>> Our understanding is that function <irqreturn_t
>> st_sensors_trigger_handler(int irq, void *p)> from file
>> linux/drivers/iio/common/st_sensors/st_sensors_buffer.c should be
>> called when interrupt is generated. Is this assumption correct? In our
>> case it's never called.
>>
>> Thanks in advance
>> Branko
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-23 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-23 16:01 Trigger (drdy) on st-sensor lis331dlh - how to question Branko Karaklajic
2014-09-23 16:12 ` Denis CIOCCA
2014-09-23 16:45 ` Branko Karaklajic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.