Skip to contentSkip to conversation

ST driver - ad-hoc allocation of trigger interrupt

DISCUSSION [email protected] 3 participants 4 messages Jun 15, 2015 – Jun 19, 2015 IIO

lore
Share & tools
lore
#0 lore raw

Hi all,
A friend and I were attempting to get a LSM303DLHC breakout board hooked up to the expansion header on the RaspPi yesterday - it was him doing the work and me offering suggestions from afar (unfortunately the blind leading the blind)...

Anyhow 'we' got reasonably far and could read raw value and trigger the buffer via the 'iio-sysfs-trig'. The problem came when we wanted the device to trigger itself at the set sample frequency.

We infer that we need to connect the DRDY signal to a CPU interrupt line, but can't see how we tell the ST iio driver which one.

I did find this is the source:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/common/st_sensors/st_sensors_trigger.c?id=refs/tags/v4.1-rc8#n21

Which shows that the 'sdata->get_irq_data_ready()' can be pre-defined in the data structure passed on driver init. But how can we do that from the command line, or even a little script/app once the kernel is up and running?

The story of our attempt is documented here:
https://groups.google.com/forum/?hl=en#!topic/richards-tech-user-forum/BjQpWjTmims

Any suggestions on how we can succeed?

Many thanks,
Simon.

maintainer
#1 lore raw
Quoted 27 lines · On 15 June 2015 16:04:58 BST, [email protected] wrote:

Hi all,
A friend and I were attempting to get a LSM303DLHC breakout board hooked
up to the expansion header on the RaspPi yesterday - it was him doing the
work and me offering suggestions from afar (unfortunately the blind leading the blind)...

Anyhow 'we' got reasonably far and could read raw value and trigger the buffer via the 'iio-sysfs-trig'. The problem came when we wanted the device to trigger itself at the set sample frequency.

We infer that we need to connect the DRDY signal to a CPU interrupt line,
but can't see how we tell the ST iio driver which one.

I did find this is the source:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/common/st_sensors/st_sensors_trigger.c?id=refs/tags/v4.1-rc8#n21

Which shows that the 'sdata->get_irq_data_ready()' can be pre-defined in
the data structure passed on driver init. But how can we do that from the
command line, or even a little script/app once the kernel is up and running?

Quoted 4 lines

The story of our attempt is documented here:
https://groups.google.com/forum/?hl=en#!topic/richards-tech-user-forum/BjQpWjTmims

Any suggestions on how we can succeed?

Looks like you basically got there with the DT file at the end. Adhoc arrangements
like this are often done with device tree overlays (which can be added to a running device). A quick Google suggests the raspberry pi uses these for standard hats.

Good luck.

Jonathan

Quoted 8 lines

Many thanks,
Simon.

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#2 lore raw
Quoted 4 lines
Quoted 4 lines

The story of our attempt is documented here:
https://groups.google.com/forum/?hl=en#!topic/richards-tech-user-forum/BjQpWjTmims

Quoted 8 lines
Quoted 1 line

Any suggestions on how we can succeed?

Looks like you basically got there with the DT file at the end. Adhoc arrangements
like this are often done with device tree overlays (which can be added to
a
running device). A quick Google suggests the raspberry pi uses these for
standard hats.

A little follow-up that you might like; Richard was able to get the IIO devices configured via Device Tree, even to the point of getting a full sensor fusion working to give pose and heading.

https://richardstechnotes.wordpress.com/2015/06/17/rteiioimu-driving-a-9-dof-imu-via-industrial-io-iio/

Simon.

#3 lore raw
Quoted 15 lines · On 18 June 2015 21:53:53 BST, [email protected] wrote:
Quoted 9 lines
Quoted 5 lines

The story of our attempt is documented here:
https://groups.google.com/forum/?hl=en#!topic/richards-tech-user-forum/BjQpWjTmims

Any suggestions on how we can succeed?

Looks like you basically got there with the DT file at the end. Adhoc arrangements
like this are often done with device tree overlays (which can be

added to

Quoted 2 lines

a
running device). A quick Google suggests the raspberry pi uses these

for

Quoted 1 line

standard hats.

Quoted 7 lines

A little follow-up that you might like; Richard was able to get the IIO devices configured via Device Tree, even to the point of getting a full sensor fusion working to give pose and heading.

https://richardstechnotes.wordpress.com/2015/06/17/rteiioimu-driving-a-9-dof-imu-via-industrial-io-iio/

Simon.

Nice.

Thanks for the heads up!

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.