<?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>nrf9160dk SPI pins</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67207/nrf9160dk-spi-pins</link><description>From the datasheet I understand that any pins in port0 can be used as SPI. But I tried using the pins defined in nrf-sdk here and but there is no response. After searching through devzone, I found pins 11 and 12 can act as MOSI and MISO and I tested it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Oct 2020 12:27:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67207/nrf9160dk-spi-pins" /><item><title>RE: nrf9160dk SPI pins</title><link>https://devzone.nordicsemi.com/thread/275079?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 12:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21640d79-454b-4fff-88a9-d40b8e674aa5</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]But I couldn&amp;#39;t find correct pins to use for CS and SCK. Also I need 2 more pins for SPI slave interrupt and Reset control.[/quote]
&lt;p&gt;CS is a generic GPIO. The SPIM module doesn&amp;#39;t have a dedicated register to set the CS, as shown in the PSEL.* register:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf9160/spim.html?cp=2_0_0_5_12_5_22#register.PSEL.SCK"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf9160/spim.html?cp=2_0_0_5_12_5_22#register.PSEL.SCK&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The CS pin must be set as a normal GPIO and controlled by the application, but there are ways of setting this up in the zephyr drivers, like this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/tests/drivers/spi/spi_loopback/boards/nrf9160dk_nrf9160.conf#L4-L6"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/tests/drivers/spi/spi_loopback/boards/nrf9160dk_nrf9160.conf#L4-L6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can have a look at the &amp;quot;spi_cs&amp;quot; in the test source code for this specific example.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The SPIx peripheral can be enabled by setting an overlay for your board (($BOARD).overlay):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts#L125-L131"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts#L125-L131&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The setup for nRF9160 is very similar to how its done in this case (which was for nRF5340):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67065/how-to-configure-and-setup-an-spi-device-to-nrf5340"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/67065/how-to-configure-and-setup-an-spi-device-to-nrf5340&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>