How to connect the LSM6DS0 sensor when using a custom board? #sensor #dts #defconfig

Stefan Jaritz


I am failing to get my LSM6DS3(almost LSM6DS0) sensor rightfully setup. Maybe someone can give me a hint.

My system:

LSM6DS3 <--> I2C1 @ stm32F412 <--> Zephyr OS

I created an own board for that. It is configured via myboard_defconfig. I added into that file:

# movement sensor

In myboard.dts I added:

&i2c1 {
    status = "ok";
    clock-frequency = <I2C_BITRATE_FAST>;

    lsm6ds0@106 {
        compatible = "st,lsm6ds0";
        reg = <0x6A>;
        label = "LSM6DS3";

I am getting following error:

~/zephyr/drivers/sensor/lsm6ds0/lsm6ds0.c:499:25: error: ‘CONFIG_LSM6DS0_I2C_MASTER_DEV_NAME’ undeclared here (not in a function)
  .i2c_master_dev_name = CONFIG_LSM6DS0_I2C_MASTER_DEV_NAME,
~/zephyr/drivers/sensor/lsm6ds0/lsm6ds0.c:500:20: error: ‘CONFIG_LSM6DS0_I2C_ADDR’ undeclared here (not in a function)
  .i2c_slave_addr = CONFIG_LSM6DS0_I2C_ADDR,
In file included from ~/zephyr/include/sensor.h:27:0,
                 from ~/zephyr/drivers/sensor/lsm6ds0/lsm6ds0.c:11:
~/zephyr/drivers/sensor/lsm6ds0/lsm6ds0.c:505:30: error: ‘CONFIG_LSM6DS0_DEV_NAME’ undeclared here (not in a function)
 DEVICE_AND_API_INIT(lsm6ds0, CONFIG_LSM6DS0_DEV_NAME, lsm6ds0_init,
~/zephyr/include/device.h:106:11: note: in definition of macro ‘DEVICE_AND_API_INIT’
   .name = drv_name, .init = (init_fn),     \

I took the hexiwear_k64 board as template.

Any ideas how to get these problem solved?


Join to automatically receive all group messages.