<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116042/using-lsm6dso-sensor-on-nrf52832</link><description>Hello, 
 I&amp;#39;m new to pretty much all of this, but I&amp;#39;ll do my best to explain my issue. As the title says, I&amp;#39;m currently trying to get a LSM6DSO sensor to work with the NRF52832 board. I&amp;#39;m using the Nordic sample code for LSM6DSO and using VSCode to build</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 08 Dec 2024 07:47:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116042/using-lsm6dso-sensor-on-nrf52832" /><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/513926?ContentTypeID=1</link><pubDate>Sun, 08 Dec 2024 07:47:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9c30aed-7f4b-455c-a1d2-fe4f29a3fd70</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;If you have a specific problem with your project, it may be more worthwhile to open a ticket&amp;nbsp;so an official Nordic rep&amp;nbsp;can be assigned to it. Work is ramping up on my end&amp;nbsp;and I don&amp;#39;t have as much time to debug others&amp;#39; projects.&amp;nbsp;The &lt;a href="https://academy.nordicsemi.com/"&gt;Nordic Academy&lt;/a&gt; is also a great resource for understanding of Zephyr configurations and bringup, it was a huge help for me and I recommend going through their two crash courses if you haven&amp;#39;t already.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/513923?ContentTypeID=1</link><pubDate>Sat, 07 Dec 2024 22:12:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:299a7073-00f7-463d-95b6-82013fbb525d</guid><dc:creator>TechSavyCoder</dc:creator><description>&lt;p&gt;Thanks for the quick response, this is my dts file&lt;pre class="ui-code" data-mode="text"&gt;
	compatible = &amp;quot;x1&amp;quot;;

	chosen {
		zephyr,sram = &amp;amp;sram0;
		zephyr,flash = &amp;amp;flash0;
		zephyr,code-partition = &amp;amp;slot0_partition;
	};

	aliases {
		button = &amp;amp;button;
		rgbled = &amp;amp;rgbled;
		accel = &amp;amp;accel;
		gyro = &amp;amp;gyro;
	};

	buttons {
		compatible = &amp;quot;gpio-keys&amp;quot;;
		button: button {
			gpios = &amp;lt;&amp;amp;gpio0 11 GPIO_ACTIVE_LOW&amp;gt;;
		};
	};
};

&amp;amp;uicr {
	gpio-as-nreset;
};

&amp;amp;gpio0 {
	status = &amp;quot;okay&amp;quot;;
};

&amp;amp;gpio1 {
	status = &amp;quot;okay&amp;quot;;
};

&amp;amp;spi1 {
	compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;spi1_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;spi1_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
	cs-gpios = &amp;lt;&amp;amp;gpio0 4 GPIO_ACTIVE_LOW&amp;gt; , &amp;lt;&amp;amp;gpio1 8 GPIO_ACTIVE_LOW&amp;gt;;
	accel: lsm6dso32@0 {
		compatible = &amp;quot;st,lsm6dso32&amp;quot;;
		reg = &amp;lt;0x0 &amp;gt;;
		spi-max-frequency = &amp;lt;8000000&amp;gt;;
		irq-gpios = &amp;lt;&amp;amp;gpio0 24 GPIO_ACTIVE_LOW&amp;gt;;
		int-pin = &amp;lt;2&amp;gt;;
		status = &amp;quot;okay&amp;quot;;
	};
	gyro: lsm6dso32@1 {
		compatible = &amp;quot;st,lsm6dso32&amp;quot;;
		reg = &amp;lt;0x1 &amp;gt;;
		spi-max-frequency = &amp;lt;8000000&amp;gt;;
		irq-gpios = &amp;lt;&amp;amp;gpio0 25 GPIO_ACTIVE_LOW&amp;gt;;
		int-pin = &amp;lt;2&amp;gt;;
		status = &amp;quot;okay&amp;quot;;
	};
};

&amp;amp;pwm0 {
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;pwm0_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;pwm0_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

&amp;amp;pwm1 {
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;pwm1_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;pwm1_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

&amp;amp;pwm2 {
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;pwm2_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;pwm2_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

&amp;amp;pinctrl {
	spi1_default: spi1_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 26)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIM_MOSI, 0, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIM_MISO, 0, 8)&amp;gt;;
		};
	};
	spi1_sleep: spi1_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 26)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIM_MOSI, 0, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIM_MISO, 0, 8)&amp;gt;;
			low-power-enable;
		};
	};
	
	pwm0_default: pwm0_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 23)&amp;gt;;
			nordic,invert;
		};
	};

	pwm0_sleep: pwm0_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 23)&amp;gt;;
			low-power-enable;
		};
	};
	pwm1_default: pwm1_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 21)&amp;gt;;
			nordic,invert;
		};
	};

	pwm1_sleep: pwm1_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 21)&amp;gt;;
			low-power-enable;
		};
	};
	pwm2_default: pwm2_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 13)&amp;gt;;
			nordic,invert;
		};
	};

	pwm2_sleep: pwm2_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(PWM_OUT0, 0, 13)&amp;gt;;
			low-power-enable;
		};
	};
};

&amp;amp;flash0 {
	partitions {
		compatible = &amp;quot;fixed-partitions&amp;quot;;
		#address-cells = &amp;lt;1&amp;gt;;
		#size-cells = &amp;lt;1&amp;gt;;

		boot_partition: partition@0 {
			label = &amp;quot;mcuboot&amp;quot;;
			reg = &amp;lt;0x0 0xc000&amp;gt;;
		};
		slot0_partition: partition@c000 {
			label = &amp;quot;image-0&amp;quot;;
			reg = &amp;lt;0xc000 0x72000&amp;gt;;
		};
		slot1_partition: partition@7e000 {
			label = &amp;quot;image-1&amp;quot;;
			reg = &amp;lt;0x7e000 0x72000&amp;gt;;
		};
		scratch_partition: partition@f0000 {
			label = &amp;quot;image-scratch&amp;quot;;
			reg = &amp;lt;0xf0000 0xa000&amp;gt;;
		};
		storage_partition: partition@fa000 {
			label = &amp;quot;storage&amp;quot;;
			reg = &amp;lt;0xfa000 0x6000&amp;gt;;
		};
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And this is my defconfig:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_X1=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# Enable driver interfaces
CONFIG_SENSOR=y
CONFIG_LED=y
CONFIG_GPIO=y
CONFIG_PWM=y
CONFIG_I2C=y
CONFIG_PINCTRL=y
CONFIG_LSM6DSO=y
CONFIG_LSM6DSR=y
CONFIG_FUEL_GAUGE=y
CONFIG_MAX17048=y
CONFIG_IMU_THREAD_STACK_SIZE=2048
CONFIG_SPI_NRFX=y
CONFIG_SPI_LOG_LEVEL_DBG=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
CONFIG_LOG=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could you please guide me what is missing here? Also, let me know if you need anything else.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/513922?ContentTypeID=1</link><pubDate>Sat, 07 Dec 2024 22:05:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5310cd1-7349-455f-ba46-bf10441ae917</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;It should, to my knowledge at least. Most of the abstractions are protocol-agnostic once you have the devicetree/overlay configured for a sensor.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/513921?ContentTypeID=1</link><pubDate>Sat, 07 Dec 2024 21:48:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:939cc161-88d7-4311-b7e4-13110cad16d2</guid><dc:creator>TechSavyCoder</dc:creator><description>&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/members/rbmarcus"&gt;rbmarcus&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I wanted to confirm whether the following functions work with SPI. If they do, could you guide me on how to configure them? It would be helpful if you can provide driver code for the same.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt; sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);&lt;br /&gt; sensor_channel_get(dev, SENSOR_CHAN_GYRO_X, &amp;amp;x);&lt;br /&gt; sensor_channel_get(dev, SENSOR_CHAN_GYRO_Y, &amp;amp;y);&lt;br /&gt; sensor_channel_get(dev, SENSOR_CHAN_GYRO_Z, &amp;amp;z);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509770?ContentTypeID=1</link><pubDate>Sat, 09 Nov 2024 20:58:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:847b43aa-7c55-46d0-8dc3-babee0609772</guid><dc:creator>connorshannon</dc:creator><description>&lt;p&gt;Hey, thank you for this super detailed response! I won&amp;#39;t be using trigger mode for my application, so I just disabled it in the .conf file as you suggested. As soon as I did that, I was able to get actual readings from the sensor. Appreciate it!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509745?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2024 22:44:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f4d3a30-9576-409f-a36e-c9db32777b98</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if specifying the int pin is necessary, it may already be done in the sample code. The GPIOs should be based on your specific setup. I&amp;#39;m running this on a custom PCB with an nRF52840 so my pinout is likely going to be different from yours, which is also why I used SPI rather than the I2C sample default. In the overlay file you can modify the pins to your liking (for the most part) since GPIOs on Nordic chips are muxed. That is, you can change both the I2C bus pins and the pins tied to your IMU. You want to pick different GPIOs for the interrupt pins than the ones you&amp;#39;re using for the I2C bus. Pick ones that look unused and then wire the chosen GPIOs to the INT1 and INT2 pins on your LSM6DSO.&lt;/p&gt;
&lt;p&gt;To troubleshoot the error message, you can enable debugging in your prj.conf with &lt;code&gt;CONFIG_LOG_DEFAULT_LEVEL&lt;/code&gt;, &lt;code&gt;CONFIG_SPI_LOG_LEVEL&lt;/code&gt;, and &lt;code&gt;CONFIG_SENSOR_LOG_LEVEL&lt;/code&gt;. Can you share your full prj.conf file?&lt;/p&gt;
&lt;p&gt;Some additional information that may be beneficial for you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Zephyr has a &lt;a href="https://docs.zephyrproject.org/latest/build/kconfig/menuconfig.html"&gt;guiconfig&lt;/a&gt;, which can also be accessed by pressing &amp;quot;nRF Kconfig GUI&amp;quot; in the Actions sidebar if you have Nordic&amp;#39;s VSCode extension&lt;/li&gt;
&lt;li&gt;Nordic offers a &lt;a href="https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/reference/ui_dve.html"&gt;DeviceTree Visual Editor UI&lt;/a&gt; with the VSCode extension&lt;/li&gt;
&lt;li&gt;Hovering over &amp;quot;st,lsm6dso&amp;quot; will take you to the &amp;quot;st,lsm6dso-12c.yaml&amp;quot; sensor bindings file, which then links you to the two includes &amp;quot;i2c-device.yaml&amp;quot; and &amp;quot;st,lsm6dso-common.yaml&amp;quot;. These files should list all the configurations available for the I2C bus and for your specific peripheral if you don&amp;#39;t want to use the GUI tools.&lt;/li&gt;
&lt;li&gt;If you haven&amp;#39;t already, I would start with CONFIG_LSM6DSO_TRIGGER_NONE instead of TRIGGER_GLOBAL_THREAD to disable trigger and enable polling. Polling mode is more straightforward and does not require the interrupt pin configuration, so you can confirm everything else works in your code.&lt;/li&gt;
&lt;li&gt;Tucked away in &lt;code&gt;/modules/hal/st/sensor/stmemsc/lsm6dso_STdC/driver&lt;/code&gt; you&amp;#39;ll see LSM6DSO_ID defined as 0x68. I was using a variant that had a different chip ID, which caused the process to fail. That doesn&amp;#39;t seem to be your issue if the error you&amp;#39;re seeing is still trigger_set op not supported, but it&amp;#39;s probably worth mentioning in case anyone else with the same problem sees this in the future.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Full disclaimer I&amp;#39;m just some random guy so I would take this information with a grain of salt. Hopefully a Nordic dev is able to help you figure out the root cause if we aren&amp;#39;t able to narrow down the problem before then.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509738?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2024 20:22:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e67151b-bd38-49f4-b389-bad88087f6d0</guid><dc:creator>connorshannon</dc:creator><description>&lt;p&gt;I played around with a few combinations and am still getting the same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509735?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2024 19:07:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:026e79d0-8415-4320-8e9d-ba262183b26a</guid><dc:creator>connorshannon</dc:creator><description>&lt;p&gt;Thank you for the response. So the changes I would need to make to my overlay file are to add something like&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        status = &amp;quot;okay&amp;quot;;
		irq-gpios = &amp;lt;&amp;amp;gpio1 12 GPIO_ACTIVE_HIGH&amp;gt;, &amp;lt;&amp;amp;gpio1 13 GPIO_ACTIVE_HIGH&amp;gt;;
        int-pin = &amp;lt;1&amp;gt;;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to my overlay file? In your example, it looks like you&amp;#39;re using spi whereas I&amp;#39;m using I2C. I also see that you specified pins 12 and 13 as the irq-gpios. For me, would those be the same pins as I&amp;#39;m using for the I2C connections (26 and 27)? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509724?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2024 17:22:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:669568d8-bb5e-437d-8d5b-49f103371397</guid><dc:creator>rbmarcus</dc:creator><description>&lt;p&gt;I was in your position about half an hour ago. I believe trigger mode is flagged as unsupported because you haven&amp;#39;t specified the trigger pin in your overlay. The error message is resolved for me when I specify int-pin and irq-gpios (with int-pin being either 1 or 2, and selecting between the first and second listed IRQ GPIO):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi1 {
	status = &amp;quot;okay&amp;quot;;
	cs-gpios = &amp;lt;&amp;amp;gpio1 10 GPIO_ACTIVE_LOW&amp;gt;,
			   &amp;lt;&amp;amp;gpio1 11 GPIO_ACTIVE_LOW&amp;gt;;
	pinctrl-0 = &amp;lt;&amp;amp;spi1_default&amp;gt;;
	lsm6dso@0 {
		compatible = &amp;quot;st,lsm6dso&amp;quot;;
		reg = &amp;lt;0x0&amp;gt;;
		spi-max-frequency = &amp;lt;8000000&amp;gt;;
        status = &amp;quot;okay&amp;quot;;
		irq-gpios = &amp;lt;&amp;amp;gpio1 12 GPIO_ACTIVE_HIGH&amp;gt;, &amp;lt;&amp;amp;gpio1 13 GPIO_ACTIVE_HIGH&amp;gt;;
        int-pin = &amp;lt;1&amp;gt;;
	};
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using LSM6DSO sensor on NRF52832</title><link>https://devzone.nordicsemi.com/thread/509011?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2024 20:11:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa920d6c-4019-40ac-821c-f49559e6a304</guid><dc:creator>connorshannon</dc:creator><description>&lt;p&gt;I realize that I didn&amp;#39;t actually include the code sample I was using, so here it is.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2020 Yestin Sun
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/drivers/sensor.h&amp;gt;

static inline float out_ev(struct sensor_value *val)
{
	return (val-&amp;gt;val1 + (float)val-&amp;gt;val2 / 1000000);
}

static void fetch_and_display(const struct device *dev)
{
	struct sensor_value x, y, z;
	static int trig_cnt;

	trig_cnt++;

	/* lsm6dso accel */
	sensor_sample_fetch_chan(dev, SENSOR_CHAN_ACCEL_XYZ);
	sensor_channel_get(dev, SENSOR_CHAN_ACCEL_X, &amp;amp;x);
	sensor_channel_get(dev, SENSOR_CHAN_ACCEL_Y, &amp;amp;y);
	sensor_channel_get(dev, SENSOR_CHAN_ACCEL_Z, &amp;amp;z);

	printf(&amp;quot;accel x:%f ms/2 y:%f ms/2 z:%f ms/2\n&amp;quot;,
			(double)out_ev(&amp;amp;x), (double)out_ev(&amp;amp;y), (double)out_ev(&amp;amp;z));

	/* lsm6dso gyro */
	sensor_sample_fetch_chan(dev, SENSOR_CHAN_GYRO_XYZ);
	sensor_channel_get(dev, SENSOR_CHAN_GYRO_X, &amp;amp;x);
	sensor_channel_get(dev, SENSOR_CHAN_GYRO_Y, &amp;amp;y);
	sensor_channel_get(dev, SENSOR_CHAN_GYRO_Z, &amp;amp;z);

	printf(&amp;quot;gyro x:%f rad/s y:%f rad/s z:%f rad/s\n&amp;quot;,
			(double)out_ev(&amp;amp;x), (double)out_ev(&amp;amp;y), (double)out_ev(&amp;amp;z));

	printf(&amp;quot;trig_cnt:%d\n\n&amp;quot;, trig_cnt);
}

static int set_sampling_freq(const struct device *dev)
{
	int ret = 0;
	struct sensor_value odr_attr;

	/* set accel/gyro sampling frequency to 12.5 Hz */
	odr_attr.val1 = 12.5;
	odr_attr.val2 = 0;

	ret = sensor_attr_set(dev, SENSOR_CHAN_ACCEL_XYZ,
			SENSOR_ATTR_SAMPLING_FREQUENCY, &amp;amp;odr_attr);
	if (ret != 0) {
		printf(&amp;quot;Cannot set sampling frequency for accelerometer.\n&amp;quot;);
		return ret;
	}

	ret = sensor_attr_set(dev, SENSOR_CHAN_GYRO_XYZ,
			SENSOR_ATTR_SAMPLING_FREQUENCY, &amp;amp;odr_attr);
	if (ret != 0) {
		printf(&amp;quot;Cannot set sampling frequency for gyro.\n&amp;quot;);
		return ret;
	}

	return 0;
}

#ifdef CONFIG_LSM6DSO_TRIGGER
static void trigger_handler(const struct device *dev,
			    const struct sensor_trigger *trig)
{
	fetch_and_display(dev);
}

static void test_trigger_mode(const struct device *dev)
{
	struct sensor_trigger trig;

	if (set_sampling_freq(dev) != 0)
		return;

	trig.type = SENSOR_TRIG_DATA_READY;
	trig.chan = SENSOR_CHAN_ACCEL_XYZ;

	if (sensor_trigger_set(dev, &amp;amp;trig, trigger_handler) != 0) {
		printf(&amp;quot;Could not set sensor type and channel\n&amp;quot;);
		return;
	}
}

#else
static void test_polling_mode(const struct device *dev)
{
	if (set_sampling_freq(dev) != 0) {
		return;
	}

	while (1) {
		fetch_and_display(dev);
		k_sleep(K_MSEC(1000));
	}
}
#endif

int main(void)
{
	printf(&amp;quot;We are in main\n&amp;quot;);
	const struct device *const dev = DEVICE_DT_GET_ONE(st_lsm6dso);
	if (!device_is_ready(dev)) {
		printk(&amp;quot;%s: device not ready.\n&amp;quot;, dev-&amp;gt;name);
		return 0;
	}

#ifdef CONFIG_LSM6DSO_TRIGGER
	printf(&amp;quot;Testing LSM6DSO sensor in trigger mode.\n\n&amp;quot;);
	test_trigger_mode(dev);
#else
	printf(&amp;quot;Testing LSM6DSO sensor in polling mode.\n\n&amp;quot;);
	test_polling_mode(dev);
#endif
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>