<?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>nRF52840 as SPI slave</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69221/nrf52840-as-spi-slave</link><description>Hello, guys! 
 We are using nRF52840 with SDK 17.2. In our system, there is a need to configure nRf52840 as SPI slave device and connect it to some other MCU. Naturally, our starting point was SPIS example. 
 We were able to properly receive SPI data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Dec 2020 12:53:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69221/nrf52840-as-spi-slave" /><item><title>RE: nRF52840 as SPI slave</title><link>https://devzone.nordicsemi.com/thread/283806?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 12:53:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aa4c3b8-e906-4c21-85e9-d1df1d34a011</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;I found the issue, guys.&lt;/p&gt;
&lt;p&gt;The problem was in the way I defined GPIOs for SPI connection. I initially did it through &lt;span style="background-color:rgba(204, 255, 255, 1);"&gt;#define&lt;/span&gt; pre-processor directives:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SPIS_CS_PIN     31 // P0.31
#define SPIS_MISO_PIN   30 // P0.30
#define SPIS_MOSI_PIN   29 // P0.29
#define SPIS_SCK_PIN    28 // P0.28&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, this was not enough. It was needed to explicitly cast to &lt;span style="background-color:rgba(204, 255, 255, 1);"&gt;uint_32t&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SPIS_CS_PIN     ((uint32_t)31) // P0.31
#define SPIS_MISO_PIN   ((uint32_t)30) // P0.30
#define SPIS_MOSI_PIN   ((uint32_t)29) // P0.29
#define SPIS_SCK_PIN    ((uint32_t)28) // P0.28&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sharing this experience with the hope to save somebody&amp;#39;s time in the future.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>