<?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>TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17035/twi0-and-spi0-time-multiplex</link><description>Hi there, 
 Is it possible to use TWI0 and SPI0 (or TWI1/SPI1) time multiplexed? 
 When enabling them both in sdk_config.h I get &amp;quot;Error: L6200E... IRQHandler multiply defined...&amp;quot;, which can be resolved by defining PERIPHERAL_RESOURCE_SHARING_ENABLED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Sep 2017 06:39:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17035/twi0-and-spi0-time-multiplex" /><item><title>RE: TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/thread/65345?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2017 06:39:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:499adc18-f00a-4670-bf53-c9db55fbdc2a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi sami_cola, from the API refrence about &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/group__nrf__drv__spi.html?cp=4_0_0_6_8_29_2_24#ga2319de449c320ce104d8f3b40759c64c"&gt;nrf_drv_spi_init&lt;/a&gt;, you have that &lt;code&gt;NRF_ERROR_BUSY&lt;/code&gt; is returned when:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If some other peripheral with the same
instance ID is already in use. This is
possible only if
PERIPHERAL_RESOURCE_SHARING_ENABLED is
set to a value other than zero.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You then need to uninit the other instance(e.g. TWIM0) before you can use e.g. the SPIM0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/thread/65344?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 16:49:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd15640a-aacb-413e-a968-7c1e198d8926</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Hello, what about the case where I must share SPIMO and TWIMO (ID 3, base addresss 0x40003000). I Went ahead and enabled PERIPHERAL_RESOURCE_SHARING_ENABLED, but then the SPI initialization fails with &amp;quot;NRF_ERROR_BUSY&amp;quot;. Is there sample code or a white paper that can advice me what to do? Do I simply need to disable/enable TWIM0 while SPIMO is initializing? I&amp;#39;m not really sure how to proceed. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/thread/65347?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2016 05:51:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:837ca607-b6bd-4021-903d-e6794c580b8f</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;I was getting the similar issue while I am trying to use SPI and TWI at the same time. Actually I was using SPI0 and TWI0. So is was creating following error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;duplicate definitions for &amp;quot;SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hence I changed TWI0 to TWI1. And now Its working fine....
This thread helped me for resolving the issue.
Thanks..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/thread/65346?ContentTypeID=1</link><pubDate>Thu, 13 Oct 2016 15:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51a7509a-9218-4672-8c59-c0ccde2ffe74</guid><dc:creator>joe.ker</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;thanks for the answer, that is exactly what I was looking for. I figured that resource sharing plus un-initializing and initializing the other one would be the way forward, thanks for the confirmation.  Documentation I was hoping to find was how to separate ppi and tasks from the 2, but maybe that&amp;#39;s straight forward then. It&amp;#39;s great that there is development going on there.&lt;/p&gt;
&lt;p&gt;Many thanks,
Josef&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI0 and SPI0 time multiplex</title><link>https://devzone.nordicsemi.com/thread/65343?ContentTypeID=1</link><pubDate>Thu, 13 Oct 2016 14:24:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb14adcc-be65-406f-8433-82fd9c83b66f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;You cannot use serveral peripheral instances that share the same IDs/base addresses at the same time, so if you want to use TWI and SPI at the same time, you should use e.g. TWI0 and SPI1. &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fmemory.html&amp;amp;cp=2_2_0_7_3&amp;amp;anchor=topic"&gt;Here&lt;/a&gt; is the table of which IDs/base address the different peripheral instances use.&lt;/p&gt;
&lt;p&gt;What the peripheral resource sharing(&lt;code&gt;PERIPHERAL_RESOURCE_SHARING_ENABLED&lt;/code&gt;) enables you to do is to first use e.g. TWI0, then you have to uninitialized it, and then you can use SPI0. Normally, this is not possible, because interrupt handlers are implemented in individual drivers. This functionality requires a more complicated interrupt handling and driver initialization, hence it is not always desirable to use it. The functionality was just recently added(SDK11), and there is not much documentation on it yet. If you want to take a look &amp;quot;under the hood&amp;quot;, you can find the implementation in &lt;code&gt;nrf_drv_common.c&lt;/code&gt;. The implementation is basically a kind of mutex, that will return &lt;code&gt;NRF_ERROR_BUSY&lt;/code&gt; if you try to initialize several peripheral instances that use the same ID/Base Address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>