I'm trying to use Adafruit LSM6DSOX (I think it's a misprint and it's actually LSM6DSO), regardless. I can get it to work using I2C but I need it over SPI.
I have been racking my mind about what's wrong. I'm getting all kinds of configuration errors.
First off, prj.conf
CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=n
CONFIG_SPI=y
CONFIG_SENSOR=y
CONFIG_LSM6DSO=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_LSM6DSO_TRIGGER_GLOBAL_THREAD=y
DT_HAS_ST_LSM6DSO_ENABLED
};
// &i2c1 {
// lsm6dso: lsm6dso@6a {
// compatible = "st,lsm6dso";
// reg = <0x6a>;
// irq-gpios = <&arduino_header 11 GPIO_ACTIVE_HIGH>; /* D5 */
// int-pin = <2>;
// gyro-odr = <1>;
// };
// };
st_lsm6dso: &spi4 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
lsm6dso: lsm6dso@0 {
compatible = "st,lsm6dso";
status = "okay";
spi-max-frequency = <10000000>;
reg = <0>;
};
};
and in main()
printf("Testing LSM6DSO sensor.\n\n");
const struct device *const dev = DEVICE_DT_GET(DT_INST(0, st_lsm6dso));
k_msleep(100);
if (!device_is_ready(dev))
{
printk("%s: device not ready.\n", dev->name);
return;
}
printf("Testing LSM6DSO sensor in polling mode.\n\n");
test_polling_mode(dev);