Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to use ADXL345 linux drivers?

Featured Replies

I'm relatively new to embedded linux so apologies if there's a simple answer to this question or if I'm not providing the necessary information. 

And if there's a concept here that I clearly don't understand please point it out as I'm doing all of this as a learning exercize.

I am attempting to use the ADXL345 accelerometer with my Orange Pi One. 

Using the i2c tools I'm able to communicate with the device but would like to use the linux drivers found here: 

https://wiki.analog.com/resources/tools-software/linux-drivers/input-misc/adxl345

 

I've tried using modprobe to insert the module but it seems it's not available and I'm unsure why as I believe they're mainline kernel drivers:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/input/misc/adxl34x.c?id=HEAD

 

I have checked /lib/modules/4.14.18-sunxi/kernel/drivers/input/misc and the module definitely isn't there so I'm unsure where to go from here.

Should I be compiling and inserting the driver myself?

Or do I need to rebuild the kernel with the driver?

Are the drivers I'm trying to use even possible with Armbian?

 

Thanks in advance for your help.

 

This driver is present in Dev builds 4.18.5 :

CONFIG_ADXL345=m
CONFIG_ADXL345_I2C=m

BTW, the final location you've look is wrong, it should be there :

/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_i2c.ko
/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_spi.ko
/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_core.ko

 

  • Author
16 hours ago, martinayotte said:

This driver is present in Dev builds 4.18.5 :


CONFIG_ADXL345=m
CONFIG_ADXL345_I2C=m

BTW, the final location you've look is wrong, it should be there :


/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_i2c.ko
/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_spi.ko
/lib/modules/4.18.5-sunxi/kernel/drivers/iio/accel/adxl345_core.ko

 

 

 Thanks martinayotte!

 

I'll have a go at building the 4.18.5 Dev build. 

Any idea why it's in two locations?

 

14 hours ago, Larry Bank said:

If you can't get that going, you can use my project as a starting point. Talking to the ADXL345 over I2C is extremely easy and writing your own code will allow you to have better control of it. Here's my code:

 

https://github.com/bitbank2/accelerometers

 

 

Cheers Larry,  however I've already written code similar to yours (but not nearly as tidy as yours haha) and am trying to learn more about embedded Linux so going to keep persevering with the mainline kernel drivers, thanks though!

  • Author
On 9/4/2018 at 12:11 AM, martinayotte said:

What do you mean ? They are at only one location "kernel/drivers/iio/accel" ...

 

There are C and header files for the 'adxl345' driver here:
 

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/accel?id=HEAD

 

While there are also C and header files for similar  'adxl34x' device drivers here:

 

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/input/misc?id=HEAD

 

And the second link is the link that is provided on the official Analog Devices wiki here:

 

https://wiki.analog.com/resources/tools-software/linux-drivers/input-misc/adxl345

 

 

Old one is using Input sub system, new one is using IIO.

Both the drivers are  working for me.

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.