<?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>[nrf51-dk] Can I use both twi instances as well as an SPI instance?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21688/nrf51-dk-can-i-use-both-twi-instances-as-well-as-an-spi-instance</link><description>I have a project where I need both TWI instances as well as an SPI instance to be used with sdcard and fatfs libraries. When I try to compile I get the error: SPI1_TWI1_IRQHandler if I have SPI1_ENABLED or SPI0_TWI0_IRQHandler if I have SPI0_ENABLED.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Apr 2017 10:56:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21688/nrf51-dk-can-i-use-both-twi-instances-as-well-as-an-spi-instance" /><item><title>RE: [nrf51-dk] Can I use both twi instances as well as an SPI instance?</title><link>https://devzone.nordicsemi.com/thread/85181?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2017 10:56:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c104a86-82aa-440c-a608-02483c7b40ac</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In the instantiation table in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf51/dita/nrf51/pdflinks/ref_manual.html?cp=3_2"&gt;nRF51 Reference Manual&lt;/a&gt; you can see that the TWI0 and SPI0 instance share the same base address/ID, and that TWI1 and SPI1 have the same base address/ID. That means that you cannot use both TWI instances + a SPI instance &lt;strong&gt;simultaneously&lt;/strong&gt; on the nRF51, if you need that you will need to upgrade to nRF52832.&lt;/p&gt;
&lt;p&gt;But, if you enable &lt;code&gt;PERIPHERAL_RESOURCE_SHARING_ENABLED&lt;/code&gt;, you can switch between using one of them (uninitialize one of them/ initialize the other). E.g. you can disable SPI1, enable TWI1, and when you are finished using TWI1 you can disable it and enable the SPI1 again.&lt;/p&gt;
&lt;p&gt;nRF51 instantiation table:
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5_5F00_2_5F00_NRF51.png" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>