Closed Panky-codes closed 4 years ago
Can we see the kernel log after boot or after modprobe ? You can check if there are some kernel messages about lsm6ds3 device ?
Hi @mariotesi. Thanks for your reply. I just found that it was an extra space (" ")for the compatible key that was creating the problem.
My final DT overlay that works is as follows:
/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 LSM6DS3 IMU sensor from ST. I was successful in writing a userspace SPI driver to interact with this sensor from my beaglebone black, 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 what is going on and what I am doing wrong here? Any help would be highly appreciated.
More information: For now, I don't want to enable interrupts for fifo mode. My DTS overlay:
My
sudo /opt/scripts/tools/version.sh
output: