How to use ADXL345 linux drivers?


 Share

1 1

Recommended Posts

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.

 

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

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

 

Link to post
Share on other sites

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!

Link to post
Share on other sites

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

 

 

Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

1 1