Closed Panky-codes closed 4 years ago
@Panky-codes , just to clarify...
You wrote:
compatible = "st, lsm6ds3";
did you add the " " (space) when you copied?
- compatible: must be one of:
"st,lsm6ds3"
"st,lsm6ds3h"
"st,lsm6dsl"
"st,lsm6dsm"
"st,ism330dlc"
"st,lsm6dso"
"st,asm330lhh"
"st,lsm6dsox"
"st,lsm6dsr"
"st,lsm6ds3tr-c"
"st,ism330dhcx"
"st,lsm9ds1-imu"
"st,lsm6ds0"
"st,lsm6dsrx"
you spi frequency might be too "slow" for the bus.. give 1 of these 3 a try..
spi-max-frequency = <8000000>;
spi-max-frequency = <12000000>;
spi-max-frequency = <16000000>;
Regards,
Hello @RobertCNelson. Thanks a lot for your reply. That was spot on. The mistake was indeed space ( " ") as you mentioned. I saw some examples where spaces were used and somehow it became a part of my DT overlay. I just removed the space from the DT overlay file, and now BBB is detecting the IMU automatically. The final DT overlay if someone wants to use this device is as follow:
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-LSM6DX";
version = "00A0";
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.17", /* P9_17 (A16) spi0_cs0.spi0_cs0 */
"P9.18", /* P9_18 (B16) spi0_d1.spi0_d1 */
"P9.21", /* P9_21 (B17) spi0_d0.spi0_d0 */
"P9.22", /* P9_22 (A17) spi0_sclk.spi0_sclk */
/* the hardware ip uses */
"spi0";
/*
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
fragment@0 {
target-path="/";
__overlay__ {
chosen {
overlays {
BB-LSM6DSX-00A0 = __TIMESTAMP__;
};
};
};
};
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@1 {
target = <&ocp>;
__overlay__ {
P9_17_pinmux { status = "disabled"; }; /* P9_17 (A16) spi0_cs0.spi0_cs0 */
P9_18_pinmux { status = "disabled"; }; /* P9_18 (B16) spi0_d1.spi0_d1 */
P9_21_pinmux { status = "disabled"; }; /* P9_21 (B17) spi0_d0.spi0_d0 */
P9_22_pinmux { status = "disabled"; }; /* P9_22 (A17) spi0_sclk.spi0_sclk */
};
};
fragment@2 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0) /* P9_22 (A17) spi0_sclk.spi0_sclk */
AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT, MUX_MODE0) /* P9_21 (B17) spi0_d0.spi0_d0 */
AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0) /* P9_18 (B16) spi0_d1.spi0_d1 */
AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE0) /* P9_17 (A16) spi0_cs0.spi0_cs0 */
>;
};
};
};
fragment@3 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi0_pins>;
channel@0 {
status = "disabled"; /* Enabled by default in bb-kernel so users can use spidev from userspace */
};
channel@1 {
status = "disabled";
};
lsm6ds3: lsm6ds3@0 {
spi-max-frequency = <500000>;
compatible = "st,lsm6ds3";
reg = <0x0>;
};
};
};
};
I have an LSM6DS3 IMU sensor from ST. I was successful in writing a userspace SPI driver to interact with this sensor from my beaglebone, and now I am trying to use an IIO kernel module driver,
st_lsm6dsx_spi
that comes pre-built. However, even after countless hours of debugging, I am having trouble getting it to work from kernel space.I adapted my overlay (posted below) to use this LKM for spi0. I can see a device being created in /sys/bus/spi as follows:
But I don't see the correct driver is loaded for it. It not creating any char device in
/dev/
directory nor I can see any sign of it in/sys/bus/iio/devices
directory. No effect even if I try to manually load the driver, st_lsm6dsx_spi using modprobe.Could someone say how to proceed from here? Any help would be highly appreciated.
More information: I disabled the universal overlay as it loads spidev driver in the available spi channels. My
sudo /opt/scripts/tools/version.sh
output:My DTS overlay: