<?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>Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices</link><description>Hello, 
 I&amp;#39;m trying to configure two TWI slave devices on the same TWI bus on my custom board(nRF52832). One slave is RTC, and the other is a biosensor. The TWI configuration for RTC seems to work. So I adopt the similar configuration and switch to corresponding</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Jul 2019 06:39:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices" /><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/199653?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 06:39:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eea9a9ab-4731-4db0-8841-de0604e40e10</guid><dc:creator>Kartik</dc:creator><description>&lt;p&gt;For all on chip sensors on the Nordic Thingy TWI_INSTANCE 0 is used.&lt;/p&gt;
&lt;p&gt;Now if I connected the max30105 (external pulse oximeter) sensor on TWI EXT bus (pins 14 and 15), I should define a new twi_instance 1, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/199198?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2019 09:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a30668f6-1795-4ded-b8d1-30d0a5c2ace7</guid><dc:creator>awneil</dc:creator><description>[quote userid="80855" url="~/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices/199186"]as I understand it, in Nordic Thingy 52 application[/quote][quote userid="80855" url="~/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices/199186"]all sensors except the motion sensor (lis2dh12) are interfaced on one TWI bus[/quote]
&lt;p&gt;You already have a thread on this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/49619/which-i2c-bus-is-exposed-on-nordic-thingy-52-for-custom-application-development"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/49619/which-i2c-bus-is-exposed-on-nordic-thingy-52-for-custom-application-development&lt;/a&gt;&lt;/p&gt;
[quote userid="80855" url="~/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices/199186"]For each instance a dedicated nrf_drv_twi_init() is required[/quote]
&lt;p&gt;For each TWI &lt;em&gt;&lt;strong&gt;Master&lt;/strong&gt;&lt;/em&gt; instance; so one for each TWI &lt;em&gt;&lt;strong&gt;bus&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s the number of separate buses that matters - not what&amp;#39;s connected to each bus.&lt;/p&gt;
[quote userid="80855" url="~/f/nordic-q-a/18973/twi-configuration-for-multiple-slave-devices/199186"]For each individual sensor on a TWI bus a dedicated event handler is also required[/quote]
&lt;p&gt;No. Again, it&amp;#39;s one event handler per TWI Master.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/199186?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2019 09:17:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de739d1d-6636-4df4-98a8-82bc3e83ebb6</guid><dc:creator>Kartik</dc:creator><description>&lt;p&gt;So, as I understand it, in Nordic Thingy 52 application,&lt;/p&gt;
&lt;p&gt;- all sensors except the motion sensor (lis2dh12) are interfaced on one TWI bus (TWI_SCL and TWI_SDA)&lt;/p&gt;
&lt;p&gt;- while the motion sensor is interfaced to a different TWI bus (TWI_SCL_EXT andd TWI_SDA_EXT)&lt;/p&gt;
&lt;p&gt;For each instance a dedicated nrf_drv_twi_init() is required?&lt;/p&gt;
&lt;p&gt;For each individual sensor on a TWI bus a dedicated event handler is also required so that it works in non-blocking mode.&lt;/p&gt;
&lt;p&gt;So, suppose I want to interface an I2C sensor to the default Nordic Thingy 52 application:&lt;/p&gt;
&lt;p&gt;1. I should physically connect the sensor with TWI external bus (TWI_SCL_EXT and TWI_SDA_EXT)&lt;/p&gt;
&lt;p&gt;2. I should&amp;nbsp;use the TWI external bus instance to initialize the config params and event handler.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How come the Nordic Thingy 52 application have same twi_instance for motion sensor as that of other sensors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/168544?ContentTypeID=1</link><pubDate>Tue, 29 Jan 2019 16:52:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55c37820-a570-47c7-bb72-9238232fe81d</guid><dc:creator>alexSvarc</dc:creator><description>&lt;p&gt;Tested my case with one TWI instance shared for both slaves, it works... So for future reference for everyone interested, if you are using only two I2C pins to connect multiple slaves you need only one TWI instance, otherwise if you are connecting the slaves on different I2C pins you need multiple TWI instances...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/168532?ContentTypeID=1</link><pubDate>Tue, 29 Jan 2019 16:03:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55844144-199f-4e7c-8f1f-9bb31f2683a2</guid><dc:creator>alexSvarc</dc:creator><description>&lt;p&gt;i have two slaves connected on the same I2C pins on NRF52-DK, i created two I2C instances but i am unable to read/write to the two slaves, if i enable the two instances I2C stops working, does this mean that i need to share the same I2C instance for both slaves?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/73332?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2017 19:36:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbe7652c-a9d8-49e5-a16c-c927923b4927</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you able to provide a trace of the transfer from a logic analyzer? I haven&amp;#39;t worked with AS7000, but if the transmission is aborted due to a NACK, it might be busy. Maybe you can ask the developer of the sensor?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/73331?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2017 08:46:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6db3f72-5393-45c4-9370-d242842a398f</guid><dc:creator>Switchfeet</dc:creator><description>&lt;p&gt;Thank you for your reply and reference.&lt;/p&gt;
&lt;p&gt;As a matter of fact, I just want to utilize the current TWI instance(i.e. NRF_DRV_TWI_INSTANCE(0)), so it&amp;#39;s no need to initiate a new TWI instance. So what I&amp;#39;ve done was unnecessary. Finally, I figure out that all I have to do is to send i2c write/read with slave address of biosensor. ;) And the biosensor is ams as7000.&lt;/p&gt;
&lt;p&gt;But here comes another problem. When I try to send data(intel hex file) repeatedly (amount to 80KBytes) via I2C to biosensor, only about 40KBytes were transmitted successfully because of I2C timeout (i.e. NACK from as7000; maybe it&amp;#39;s busy), I&amp;#39;ve tried to increase/decrease i2c timeout but still got 40KBytes at most. Do you have any ideas that I can try? Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Twi configuration for multiple slave devices</title><link>https://devzone.nordicsemi.com/thread/73330?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:573e6cbb-8d7e-44f4-9c4b-3ddb6615d6b5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The reason why your code is not working, is that you are initializing two TWI interfaces on the same serial interface. One address only support one interface at the time. You can see which addresses support which interfaces on &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/memory.html?cp=2_2_0_7_3#topic"&gt;this page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You need to change the line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static const nrf_drv_twi_t m_twi_bio = NRF_DRV_TWI_INSTANCE(0);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static const nrf_drv_twi_t m_twi_bio = NRF_DRV_TWI_INSTANCE(1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>