<?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>TWIS instances</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49410/twis-instances</link><description>Hi, 
 I have a situation where I have to create 4 TWIS instances on nRF52832. 
 sdk_config.h only shows 2 TWIS instances. 
 
 
 Is it ok if I add other instances (TWIS2_ENABLED and TWIS3_ENABLED) in sdk_config myself (haven&amp;#39;t tried it yet) 
 If not, how</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Jul 2019 09:01:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49410/twis-instances" /><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/197047?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 09:01:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3184aa7e-e5be-4934-8d8f-fd7ed5c67a57</guid><dc:creator>awneil</dc:creator><description>[quote userid="2116" url="~/f/nordic-q-a/49410/twis-instances/197026"]as long as the total capacitance on the bus is not too high[/quote]
&lt;p&gt;Indeed.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/anita"&gt;Anisa&lt;/a&gt; Note that this is a standard I2C thing - not specific to Nordic.&lt;/p&gt;
&lt;p&gt;I2C is designed for &lt;em&gt;&lt;strong&gt;short&lt;/strong&gt; &lt;/em&gt;connections between chips on the same PCB - so, as &lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt; says, capacitance should not &lt;em&gt;normally&lt;/em&gt; be a problem.&lt;/p&gt;
&lt;p&gt;But a common case where problems &lt;em&gt;&lt;strong&gt;do&lt;/strong&gt;&lt;/em&gt; often arise is when prototyping and attaching dev kits together with long wires.&amp;nbsp;Solderless breadboards are particularly notorious for having high capacitance.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/49410/twis-instances/197026"]if you connect a scope to the bus you can see if the signalling looks OK[/quote]
&lt;p&gt;Absolutely!&lt;/p&gt;
&lt;p&gt;An oscilloscope is an indispensable tool here!&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/49410/twis-instances/197026"]If capacitance issues do occur there are some ways to handle it[/quote]
&lt;p&gt;there are also chips available for &amp;quot;extending&amp;quot; I2C buses where capacitance becomes a problem ...&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/49410/twis-instances/197026"]I would suggest adding a single slave at a time and make sure it all runs nicely[/quote]
&lt;p&gt;Absolutely!&lt;/p&gt;
&lt;p&gt;As a general rule, &lt;strong&gt;always start simple&lt;/strong&gt; - and work up...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/197026?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 08:36:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80241d99-5490-485b-ab58-02a030bfaf34</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Anita&lt;/p&gt;
&lt;p&gt;In order to communicate to an I2C slave the nRF52 device needs to be in master mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In other words you should use a TWIM instance, not a TWIS instance.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A single TWIM instance should be enough to communicate with 4 slaves, as long as the total capacitance on the bus is not too high (in general the more slaves you have the more capacitance you get). Most likely this won&amp;#39;t be an issue, but if you start to see communication issues when adding more slaves then it is usually caused by excessive bus capacitance. I would suggest adding a single slave at a time and make sure it all runs nicely (if you connect a scope to the bus you can see if the signalling looks OK).&amp;nbsp;&lt;br /&gt;If capacitance issues do occur there are some ways to handle it, such as adding stronger pull up resistors on the bus (lower resistance), setting the nRF52 pins in high drive mode, and reducing the I2C clock frequency.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When using the twi master driver you have to provide the address for every transaction, allowing you to select which sensor to talk to.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For an example, have a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__drv__twi.html#ga6c83eac2d358bc8fb5b53c53f22506b6"&gt;API documentation for the nrf_drv_twi_tx(..)&lt;/a&gt; function, and note the address parameter.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/197020?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 08:24:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c17910da-15d0-4d49-b0b4-5c35c6bb91c9</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Still not entirely clear, I&amp;#39;m afraid - a &lt;strong&gt;diagram&lt;/strong&gt; is a far more effective way of conveying this sort of information!&lt;/p&gt;
&lt;p&gt;In particular, &lt;strong&gt;is the nRF52 is the Master on the I2C bus?&lt;/strong&gt;&lt;/p&gt;
[quote userid="81289" url="~/f/nordic-q-a/49410/twis-instances/196964"]They all have different I2C address[/quote]
&lt;p&gt;Of course they do - that is a fundamental requirement of any I2C bus!&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nxp.com/docs/en/user-guide/UM10204.pdf"&gt;https://www.nxp.com/docs/en/user-guide/UM10204.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/I%C2%B2C"&gt;https://en.wikipedia.org/wiki/I%C2%B2C&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/196964?ContentTypeID=1</link><pubDate>Sun, 07 Jul 2019 10:54:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:428217c3-0a49-431d-a535-b6ee9c555890</guid><dc:creator>Anisa</dc:creator><description>&lt;p&gt;May be I should explain further in detail. My 4 slaves are sharing the same I2C bus. They all have different I2C address. In this case, should I create 4 twis instances or only 1 twis instance?&lt;/p&gt;
&lt;p&gt;I understood it should be 1 instance. How should I define I2C address of slaves, initialize and enable?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/196862?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2019 13:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd7f4895-6f6b-4371-836a-209ac4bd1df0</guid><dc:creator>awneil</dc:creator><description>[quote userid="2116" url="~/f/nordic-q-a/49410/twis-instances/196856"]you can use a single master on the nRF52 device to communicate to all your slaves, since TWI allows a single bus to be shared between devices.[/quote]
&lt;p&gt;Indeed:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1562334232185v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/twim.html#concept_scx_f5p_xr__fig_swz_gvp_xr"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/twim.html#concept_scx_f5p_xr__fig_swz_gvp_xr&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/196856?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2019 13:22:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:560349f3-5db6-424a-aa6a-0da38c703c18</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Anita&lt;/p&gt;
&lt;p&gt;I am a bit confused whether or not you need the nRF52832 to be the TWI master or slave.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you really have 4 TWI master devices that all need to talk to the nRF52, or do you have 4 TWI slaves that you are trying to connect to the nRF52?&lt;/p&gt;
&lt;p&gt;Normally your controller (ie the nRF52) would be the master on the bus, and your sensors would be slaves.&amp;nbsp;&lt;br /&gt;In this configuration you can use a single master on the nRF52 device to communicate to all your slaves, since TWI allows a single bus to be shared between devices.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIS instances</title><link>https://devzone.nordicsemi.com/thread/196750?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2019 08:49:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecab1603-8181-49b1-9c36-e05c99130467</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Look in the &lt;strong&gt;Product Specification&lt;/strong&gt; - it tells you how many TWIS hardware blocks are present in the chip. You can&amp;#39;t have more than that!&lt;/p&gt;
&lt;p&gt;But note that the Product Spec also says:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;quot;&lt;em&gt;The TWI slave is able to listen for up to two addresses at the same time&lt;/em&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;So maybe you could have 2 instances each listening to 2 addresses ... ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>