<?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>How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93358/how-can-i-use-two-i2c-modules</link><description>Hi, 
 I want to measure CO2 in different locations using two similar CO2 sensor ( MiCS-VZ-89TE). I can communicate with the sensor over I2C0. 
 But because two sensors have exactly the same I2C address, I cannot connect the second sensor to the same I2C0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Nov 2022 08:56:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93358/how-can-i-use-two-i2c-modules" /><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/396351?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 08:56:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4f083f1-1917-4855-85af-8b45f2af007a</guid><dc:creator>kahlenberg</dc:creator><description>&lt;p&gt;I solved my problem.&lt;/p&gt;
&lt;p&gt;I deleted all of the &amp;quot;arduino&amp;quot; sections in the device-tree file and it works now.&lt;/p&gt;
&lt;p&gt;P0.30 and P0.31 were being used in &lt;strong&gt;arduino header&lt;/strong&gt;, &lt;strong&gt;arduino connector&lt;/strong&gt; and so on. When I deleted all of arduino related things, it worked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/394630?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 09:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12dfdc95-92a9-4776-a6fd-9d362086db81</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The error message comes from the TWIM or TWI driver here: &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/78a9e8effce0366562b9bb1f4e08096fa4cb13b9/drivers/i2c/i2c_nrfx_twim.c#L171"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/78a9e8effce0366562b9bb1f4e08096fa4cb13b9/drivers/i2c/i2c_nrfx_twim.c#L171&lt;/a&gt; or here &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/i2c/i2c_nrfx_twi.c#L126"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/i2c/i2c_nrfx_twi.c#L126&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Do you have a logic analyzer or scope you can use to check if anything if anything is being transmitted on P0.30 and P0.31 or if both lines are kept low?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/394242?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2022 21:16:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10702b24-2fb3-4187-86ef-77a35b7ff413</guid><dc:creator>kahlenberg</dc:creator><description>&lt;p&gt;When I activate logs, I receive the following error in NRF Terminal:&lt;pre class="ui-code" data-mode="batchfile"&gt;[00:00:01.506,469] &amp;lt;err&amp;gt; i2c_nrfx_twi: Error on I2C line occurred for message 0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what it means.&lt;/p&gt;
&lt;p&gt;In the&amp;nbsp;nRF52840_DK_User_Guide_20201203 Document, P0.30 and P0.31 are mapped to AIN6 and AIN7.&amp;nbsp;&lt;br /&gt;But I found something in devicetree file &lt;strong&gt;nrf52840dk_nrf52840.dts&lt;/strong&gt;. P0.30 and P0.31 are mapped to AIN6 and AIN7.&lt;/p&gt;
&lt;p&gt;I deactivated them but it still doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	arduino_adc: analog-connector {
		compatible = &amp;quot;arduino,uno-adc&amp;quot;;
		#io-channel-cells = &amp;lt;1&amp;gt;;
		io-channel-map = &amp;lt;0 &amp;amp;adc 1&amp;gt;;	/* A0 = P0.3 = AIN1 */
		/* 		 &amp;lt;1 &amp;amp;adc 2&amp;gt;,	/* A1 = P0.4 = AIN2 */
		/*		 &amp;lt;2 &amp;amp;adc 4&amp;gt;,	/* A2 = P0.28 = AIN4 */
		/*		 &amp;lt;3 &amp;amp;adc 5&amp;gt;,	/* A3 = P0.29 = AIN5 */
		/*       &amp;lt;4 &amp;amp;adc 6&amp;gt;,	/* A4 = P0.30 = AIN6 */
		/*       &amp;lt;5 &amp;amp;adc 7&amp;gt;;	/* A5 = P0.31 = AIN7 */
	};
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/394064?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2022 08:36:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff08a0ca-817c-491a-a1ff-a6c1c2d280dc</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The &lt;span&gt;&lt;a title="ADDRESS" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/twim.html?cp=4_0_0_5_30_6_29#register.ADDRESS"&gt;ADDRESS&lt;/a&gt;&lt;/span&gt; register is set when the i2c driver starts a transaction, so the fact that it is not set could indicate that something failed earlier in the init process.&lt;/p&gt;
&lt;p&gt;Do you have debug logs enabled (CONFIG_LOG=y) to see if the driver reports any errors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/393699?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 14:28:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f0aeed1-896e-4b9a-8511-963ec9be14a9</guid><dc:creator>kahlenberg</dc:creator><description>&lt;p&gt;I am able to debug it, but I don&amp;#39;t know where to look/check.&lt;/p&gt;
&lt;p&gt;It seems TWIM0 and TWIM1 registers are configured correctly, at least pin numbers in PSEL are correct.&lt;br /&gt;But in Address (is it a register?) is wrong. At TWIM0 it is 0x70, and at TWIM1 it is 0.&lt;/p&gt;
&lt;p&gt;My devicetree overlay snippet:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;i2c0 {
    vz89te0: vz89te0@70 {
        compatible = &amp;quot;i2c-device&amp;quot;;
        label = &amp;quot;MiCS-VZ-89TE-0&amp;quot;;
        reg = &amp;lt;0x70&amp;gt;;
    };
};

&amp;amp;i2c1 {
    status = &amp;quot;okay&amp;quot;;
    vz89te1: vz89te1@70 {
        compatible = &amp;quot;i2c-device&amp;quot;;
        label = &amp;quot;MiCS-VZ-89TE-1&amp;quot;;
        reg = &amp;lt;0x70&amp;gt;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1667399733838v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/393404?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 09:51:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11596370-1f14-4cd3-90e0-c0d62eb41a30</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Are you able to debug your driver to see where it fails when you select i2c1? It may also be a good idea to check the TWIM0/1 registers to see if they are being configured correctly.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:100%;max-width:100%;" src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2604.pastedimage1666942020149v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/393246?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 13:14:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e768cb87-684f-4daa-8754-64b69ec35b1a</guid><dc:creator>kahlenberg</dc:creator><description>&lt;p&gt;Ok, thank you for answer. I connected the sensor to I2C1 pins P0.30 and P0.31, I cannot communicate with sensor.&lt;/p&gt;
&lt;p&gt;When I connect the sensor to I2C0 over P0.26 and P0.27, I can communicate.&lt;/p&gt;
&lt;p&gt;Is there any other settings in devicetree overlay or CONFIG variables?&lt;/p&gt;
&lt;p&gt;In my devicetree overlay I have:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;i2c1 {
    status = &amp;quot;okay&amp;quot;;
    vz89te1: vz89te@70 {
        compatible = &amp;quot;i2c-device&amp;quot;;
        label = &amp;quot;MiCS-VZ-89TE-1&amp;quot;;
        reg = &amp;lt;0x70&amp;gt;;
    };
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;status = &amp;quot;okay&amp;quot;, because, as default in devicetree file, status = &amp;quot;okay&amp;quot; is commented, so I wrote it in overlay file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I use two I2C modules?</title><link>https://devzone.nordicsemi.com/thread/393180?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 09:47:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60701139-d080-4f6b-bbf8-2a342ae9c66b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The default pin assignments for SDA and SCL are usually defined in board files. For instance, here if you use the &amp;#39;52840dk_nrf52840&amp;#39;: &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840-pinctrl.dtsi#L62"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840-pinctrl.dtsi#L62&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>