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
CONFIG_LSM6DSO was assigned the value y, but got the value n. Missing dependencies:
DT_HAS_ST_LSM6DSO_ENABLED
DT_HAS_ST_LSM6DSO_ENABLED
DTS is:
/dts-v1/;
#include <nordic/nrf5340_cpuapp_qkaa.dtsi>
#include "nrf5340_cpuapp_common.dts"
/ {
model = "Nordic NRF5340 DK NRF5340 Application";
compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";
chosen {
zephyr,sram = &sram0_image;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,sram-secure-partition = &sram0_s;
zephyr,sram-non-secure-partition = &sram0_ns;
};
};
&arduino_header {
gpio-map = <0 0 &gpio0 4 0>,
<1 0 &gpio0 5 0>,
<2 0 &gpio0 6 0>,
<3 0 &gpio0 7 0>,
<4 0 &gpio0 25 0>,
<5 0 &gpio0 26 0>,
<6 0 &gpio1 0 0>,
<7 0 &gpio1 1 0>,
<8 0 &gpio1 4 0>,
<9 0 &gpio1 5 0>,
<10 0 &gpio1 6 0>,
<11 0 &gpio1 7 0>,
<12 0 &gpio1 8 0>,
<13 0 &gpio1 9 0>,
<14 0 &gpio1 10 0>,
<15 0 &gpio1 11 0>,
<16 0 &gpio1 12 0>,
<17 0 &gpio1 13 0>,
<18 0 &gpio1 14 0>,
<19 0 &gpio1 15 0>,
<20 0 &gpio1 2 0>,
<21 0 &gpio1 3 0>;
};
// &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);
Whatever I do I can't get it to work over SPI, any ideas?
It gets to the Device not ready