ADXL345: which interrupt to use?

404 views
Skip to first unread message

Drew Fustini

unread,
Mar 2, 2016, 2:22:32 PM3/2/16
to beagl...@googlegroups.com
I'm trying to get the ADXL345 accelerometer working with the adxl345
input kernel driver, but I'm confused about what interrupt number to
specify for it

I'm using a BeagleBone Green with the Grove 3-Axis Digital
Accelerometer (SKU: 101020054):
http://www.seeedstudio.com/wiki/Grove_-_3-Axis_Digital_Accelerometer_ADXL345

The BBG is running Linux 4.5-rc4 built with Robert's linux-dev scripts:
https://github.com/RobertCNelson/linux-dev

For reference, this is the ADXL345 userspace library from Seeed:
https://github.com/Seeed-Studio/Accelerometer_ADXL345

I'm using this information from the Analog Devices wiki:
ADXL345 Input 3-Axis Digital Accelerometer Linux Driver:
https://wiki.analog.com/resources/tools-software/linux-drivers/input-misc/adxl345

I created this Device Tree Overlay based on that wiki page:
https://gist.github.com/pdp7/cd47cdc2a6747c8b01a5#device-tree-overlay

However, I am uncertain what value to use for "interrupts":

adxl345@0 {
compatible = "adi,adxl345";
reg = <0x53>;
interrupt-parent = <&gpio3>;
interrupts = <19 0x0>;
};

I load the overlay and driver as shown in this Gist:
https://gist.github.com/pdp7/cd47cdc2a6747cb01a5#load-driver

This line then appears in /proc/interrupts:
145: 0 481ae000.gpio 19 Level 2-0053

I run evtest for /dev/input/event2 (ADXL34x accelerometer), but no
events ever occur.

Any ideas as to how I can troubleshoot further?


thanks!
drew

Robert Nelson

unread,
Mar 2, 2016, 2:33:05 PM3/2/16
to Beagle Board
On Wed, Mar 2, 2016 at 1:22 PM, Drew Fustini <pdp7...@gmail.com> wrote:
> I'm trying to get the ADXL345 accelerometer working with the adxl345
> input kernel driver, but I'm confused about what interrupt number to
> specify for it
>
> I'm using a BeagleBone Green with the Grove 3-Axis Digital
> Accelerometer (SKU: 101020054):
> http://www.seeedstudio.com/wiki/Grove_-_3-Axis_Digital_Accelerometer_ADXL345
>
> The BBG is running Linux 4.5-rc4 built with Robert's linux-dev scripts:
> https://github.com/RobertCNelson/linux-dev
>
> For reference, this is the ADXL345 userspace library from Seeed:
> https://github.com/Seeed-Studio/Accelerometer_ADXL345
>
> I'm using this information from the Analog Devices wiki:
> ADXL345 Input 3-Axis Digital Accelerometer Linux Driver:
> https://wiki.analog.com/resources/tools-software/linux-drivers/input-misc/adxl345
>
> I created this Device Tree Overlay based on that wiki page:
> https://gist.github.com/pdp7/cd47cdc2a6747c8b01a5#device-tree-overlay
>
> However, I am uncertain what value to use for "interrupts":
>
> adxl345@0 {
> compatible = "adi,adxl345";
> reg = <0x53>;
> interrupt-parent = <&gpio3>;
> interrupts = <19 0x0>;
> };
>
> I load the overlay and driver as shown in this Gist:
> https://gist.github.com/pdp7/cd47cdc2a6747cb01a5#load-driver

Here's how i've done this:

Define a pinmux:

https://github.com/RobertCNelson/dtb-rebuilder/blob/4.1-ti/src/arm/am335x-cape-bbb-exp-c.dtsi#L47-L52

BONE_P9_23 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a1.gpio1_17 */

Then in the i2c device node:

pinmux reference:

pinctrl-names = "default";
pinctrl-0 = <&edt_ft5306_ts_pins>;

Then the irq stuff:

interrupt-parent = <&gpio1>; /* gpio1_17 is on &gpio1 */
interrupts = <17 0>; /* 17 fro gpio1_17, 0 is active high */

https://github.com/RobertCNelson/dtb-rebuilder/blob/4.1-ti/src/arm/am335x-cape-bbb-exp-c.dtsi#L90-L102

https://github.com/RobertCNelson/dtb-rebuilder/blob/4.1-ti/include/dt-bindings/gpio/gpio.h

Regards,

--
Robert Nelson
https://rcn-ee.com/

Robert Nelson

unread,
Mar 2, 2016, 3:23:01 PM3/2/16
to Beagle Board
On Wed, Mar 2, 2016 at 1:32 PM, Robert Nelson <robert...@gmail.com> wrote:
> On Wed, Mar 2, 2016 at 1:22 PM, Drew Fustini <pdp7...@gmail.com> wrote:
>> I'm trying to get the ADXL345 accelerometer working with the adxl345
>> input kernel driver, but I'm confused about what interrupt number to
>> specify for it
>>
>> I'm using a BeagleBone Green with the Grove 3-Axis Digital
>> Accelerometer (SKU: 101020054):
>> http://www.seeedstudio.com/wiki/Grove_-_3-Axis_Digital_Accelerometer_ADXL345

and just looked at the board.. With only i2c connected by default,
int1/2 only on the pcb... yeah. You'd have to remove the irq
options...

Drew Fustini

unread,
Mar 2, 2016, 8:53:29 PM3/2/16
to beagl...@googlegroups.com
On Wed, Mar 2, 2016 at 2:22 PM, Robert Nelson <robert...@gmail.com> wrote:
> and just looked at the board.. With only i2c connected by default,
> int1/2 only on the pcb... yeah. You'd have to remove the irq
> options...

Ah, thanks! I didn't notice the INT1 and INT2 pads on the board until
you mentioned. I will try to wire it up. A bit awkward for Grove,
but I don't think I can get evtest to output anything otherwise.
Although I am wondering if there is a way to poll /dev/input/event2.

thanks,
drew
Reply all
Reply to author
Forward
0 new messages