<?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>BMI088 and Zephyr I2C</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94180/bmi088-and-zephyr-i2c</link><description>Hi all, 
 
 
 I&amp;#39;m trying to work with the BMI088 IMU sensor of Bosch in Zephyr (I&amp;#39;m still learning this). 
 The problem is that I don&amp;#39;t see any samples with this sensor. I tried to use the sample for the BMI270 thinking that it would be similar but I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Mar 2023 17:16:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94180/bmi088-and-zephyr-i2c" /><item><title>RE: BMI088 and Zephyr I2C</title><link>https://devzone.nordicsemi.com/thread/415317?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 17:16:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1a03b94-b007-40fa-995e-ea4f3ee1a474</guid><dc:creator>Mike Pulice</dc:creator><description>&lt;p&gt;Greetings,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am currently working with the BMI088.&amp;nbsp; This device separates the gyro and accel functions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Whether spi or i2c your are going to have to have two entries to address each device separately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This has already been done here (although for spi you can derive what you need though)&lt;br /&gt;&lt;a id="" href="https://github.com/teamspatzenhirn/bmi088_zephyr_driver"&gt;https://github.com/teamspatzenhirn/bmi088_zephyr_driver&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BMI088 and Zephyr I2C</title><link>https://devzone.nordicsemi.com/thread/397884?ContentTypeID=1</link><pubDate>Mon, 28 Nov 2022 13:40:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79f05388-7af8-43d9-ac2c-087832891f3a</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Does the debug log report have any errors? You can enable the logging and provide us the log file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BMI088 and Zephyr I2C</title><link>https://devzone.nordicsemi.com/thread/397345?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2022 09:43:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe099617-7793-4a28-9fc2-134fbaecc79c</guid><dc:creator>pgonzaleztrucorp</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have already tried changing it but I have the same problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried something more general like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;arduino_i2c {
    mysensor: mysensor@19{
        compatible = &amp;quot;i2c-device&amp;quot;;
        reg = &amp;lt; 0x19 &amp;gt;;
        label = &amp;quot;MYSENSOR&amp;quot;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, I tried to read and write directly the registers (first time I try this):&lt;/p&gt;
&lt;p&gt;this is my main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
#include &amp;lt;drivers/i2c.h&amp;gt;
#include &amp;lt;sys/printk.h&amp;gt;

#define SLEEP_TIME_MS   500

/* Define the the addresses of relevant sensor registers and settings */
#define BMI08X_REG_ACCEL_CONF                           0x40
#define ACC_STATUS										0x03
#define ACC_PWR_CONF									0x7C
#define ACC_PWR_CTRL									0x7D
#define ACC_X_MSB										0x13
#define ACC_X_LSB										0x12

/*Get the node identifier of the sensor */
#define I2C_NODE DT_NODELABEL(mysensor)

void main(void)
{

	int ret;

/* Retrieve the API-specific device structure and make sure that the device is ready to use  */
	static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C_NODE);
	if (!device_is_ready(dev_i2c.bus)) {
		printk(&amp;quot;I2C bus %s is not ready!\n\r&amp;quot;,dev_i2c.bus-&amp;gt;name);
		return;
	}

/* Setup the sensor by writing the value 0x00 to the Power Configuration register */
	uint8_t config[2] = {ACC_PWR_CONF,0x00};
	uint8_t status[1] = {ACC_STATUS};
	ret = i2c_write_dt(&amp;amp;dev_i2c, config, sizeof(config));
	if(ret != 0){
		printk(&amp;quot;Failed to write to I2C device address %x at Reg. %x \n&amp;quot;, dev_i2c.addr,config[0]);
	}else{
		i2c_read_dt(&amp;amp;dev_i2c,status, sizeof(status));
		printk(&amp;quot;Sensor is active, status is %x&amp;quot;, dev_i2c.addr,status[0]);
	}

	while (1) {
/* Read the poition X of accelerometer from the sensor */
		uint8_t position_x[2]= {0};
		uint8_t sensor_regs[2] ={ACC_X_LSB, ACC_X_MSB};
		ret = i2c_write_read_dt(&amp;amp;dev_i2c,&amp;amp;sensor_regs[0],1,&amp;amp;position_x[0],1);
		if(ret != 0){
			printk(&amp;quot;Failed to write/read I2C device address %x at Reg. %x \r\n&amp;quot;, dev_i2c.addr,sensor_regs[0]);
		}
		ret = i2c_write_read_dt(&amp;amp;dev_i2c,&amp;amp;sensor_regs[1],1,&amp;amp;position_x[1],1);
		if(ret != 0){
			printk(&amp;quot;Failed to write/read I2C device address %x at Reg. %x \r\n&amp;quot;, dev_i2c.addr,sensor_regs[1]);
		}

		int Accel_X_int16;
		Accel_X_int16 = position_x[1] * 256 + position_x[0];

		//Print reading to console  
		printk(&amp;quot;Position X : %u C \n&amp;quot;, Accel_X_int16);
		k_msleep(SLEEP_TIME_MS);
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The output is Position X : 0&lt;/p&gt;
&lt;p&gt;I did this following the register maps at&amp;nbsp;&lt;a id="" href="https://download.mikroe.com/documents/datasheets/BMI088_Datasheet.pdf"&gt;https://download.mikroe.com/documents/datasheets/BMI088_Datasheet.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BMI088 and Zephyr I2C</title><link>https://devzone.nordicsemi.com/thread/397306?ContentTypeID=1</link><pubDate>Thu, 24 Nov 2022 06:37:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe7cf8ee-b23f-4697-a2b8-613275b49199</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Pablo,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;#39;&amp;#39;This is the overlay file, should I change the value of the register?&amp;#39;&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Yes, you have to change it. If there is missing support for your sensor, you can create a feature request for it at zephyr.&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/new/choose"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/new/choose&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>