<?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>SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58942/spi-communication-between-nrf9160dk-and-nrf52840dk</link><description>Hello, 
 I want to transfer data from nRF52840DK to nRF9160DK using SPI. I want to use nRF52840DK as master which will transfer the data and nRF9160DK as slave which will receive the data. 
 I have never worked with nRF52840DK. For SPI master, I tried</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Mar 2020 16:17:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58942/spi-communication-between-nrf9160dk-and-nrf52840dk" /><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239790?ContentTypeID=1</link><pubDate>Fri, 13 Mar 2020 16:17:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dbf77bb-f232-4f34-acc8-53d96d1fbaed</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;No problem at all, I am happy to help.&lt;/p&gt;
[quote user="Jagruti_N2A"] Many things are now clear to me.[/quote]
&lt;p&gt;I am glad to hear that!&lt;br /&gt;&lt;br /&gt;Let me know if you should encounter any more issues, or have more questions! :)&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239786?ContentTypeID=1</link><pubDate>Fri, 13 Mar 2020 16:06:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24ea9476-0ee0-46c5-bb7a-af1e5e772df2</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you so much for the detailed answer. Many things are now clear to me. I will try your solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239776?ContentTypeID=1</link><pubDate>Fri, 13 Mar 2020 15:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6da4f00b-5d31-47d1-8dae-842d2d2c0541</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Jagruti_N2A"]But still few things were unclear.[/quote]
&lt;p&gt;Is there certain parameters you are uncertain about? Please let me know, then I will explain their usage. You may also want to see the different defines in the spi.h file. It is located in NCS\zephyr\include\drivers\spi.h&lt;br /&gt;There you can read the description of each parameter, if you would like.&lt;/p&gt;
[quote user="Jagruti_N2A"]I did not understand how to set other parameters.[/quote]
&lt;p&gt;Are you referring to the bitwise &lt;em&gt;or&lt;/em&gt;&amp;nbsp;&amp;#39; | &amp;#39; operation taking place in the example code?&lt;br /&gt;The main thing to note here is that the .operation element of the spi_config struct is a 16 bit bit-field. So, you configure this by doing the bitwise&amp;nbsp;&lt;em&gt;or&lt;/em&gt; operation between the different functionality you would like. Are you familiar with bitfields and bitwise operations?&lt;br /&gt;As an example, if you were to configure slave mode and a word_size of 8, it would look like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const struct spi_config spi_cfg = 
{
    .operation = SPI_OP_MODE_SLAVE | SPI_WORD_SIZE_SET(8),
};&lt;/pre&gt;&lt;/p&gt;
[quote user="Jagruti_N2A"]As it is a slave, the cs pin will be active_low.[/quote]
&lt;p&gt;This option is not for configuring it as a slave. The option exists because some devices would rather like the CS signal to be active high, instead of active low. This is not necessary to set for your application.&lt;br /&gt;The default value is active_low, so you do not need to do anything with it when using SPI between nRF9160 and nRF52840, since both of these devices use active_low.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you are not certain how to use the SPI, you could take a look at the &lt;em&gt;hci_spi&lt;/em&gt; example from the ncs sdk, located in ncs\zephyr\samples\bluetooth\hci_spi&lt;br /&gt;This example demonstrates pushing data received from BLE to another device using SPI.&lt;br /&gt;The example documentation can be seen &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/zephyr/samples/bluetooth/hci_spi/README.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Please let me know if things are still unclear.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239598?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 16:49:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1862dc06-1bc3-4529-b1ba-d3b4a7af13b0</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;I read the SPI API reference. But still few things were unclear.&lt;/p&gt;
&lt;p&gt;My spi config struct looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const struct spi_config spi_cfg = {
//	.operation = SPI_OP_MODE_SLAVE | SPI_MODE_CPOL | SPI_MODE_CPHA,
        .operation = SPI_OP_MODE_SLAVE,
	.frequency = 4000000,
	//.slave = 1,

};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I did not understand how to set other parameters. As it is a slave, the cs pin will be active_low. But how to set the spi mode that I did not understand and even in .slave parameter what value goes, that is also not clear to me. While configuring master, it was set to 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239596?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 16:41:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78e874b5-0c4d-460c-af3f-05a30868c4cb</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;I see.&lt;br /&gt;If you would share the relevant code you have written to configure your nRF9160 as SPI Slave, I could take a look.&lt;br /&gt;&lt;br /&gt;Do you configure it as&amp;nbsp;&lt;span&gt;SPI&lt;/span&gt;&lt;span&gt;_OP_MODE_&lt;/span&gt;&lt;span&gt;SLAVE in the SPI config?&lt;br /&gt;The different configuration parameters are detailed in the Zephyr SPI API Reference I linked earlier.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239594?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 16:19:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18b8b39c-a3e3-4ae8-9b34-591c8cb11d59</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Yes the performance was as expected when I flashed SPI master example on nrf52 and as well as on nrf91. On nrf91, I used zephyr spi drivers. But when I connected nrf91 spi salve to nrf52 spi master. The data was not received on nrf91. There was error on nrf91 side. I think I did not configure nrf91 as spi slave properly. That&amp;#39;s why the error is coming and there is no communication between nrf52 and nrf91. I have not yet understood how to the configuration for spi slave. I must be missing something.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239510?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 11:38:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4131d07-4c50-4c87-824d-7467e670f1d8</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Jagruti_N2A"]Thank you for the documentation.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="Jagruti_N2A"]Separately they are working properly.[/quote]
&lt;p&gt;What do you mean when you say this; do you mean that the performance was as expected when you flashed one device with the SPI Slave example, and another one with the SPI Master example?&lt;/p&gt;
[quote user="Jagruti_N2A"]I2C communication is good between both the DKs.[/quote]
&lt;p&gt;I am glad to hear that you have achieve the communication you were after.&lt;br /&gt;If required, I would not think setting up SPI should prove to be a large endeavor.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239492?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 10:23:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9b11a29-0f89-4855-87c6-baa091766872</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Thank you for the documentation.&lt;/p&gt;
&lt;p&gt;Yes I was looking for Zephyr SPI driver as well as nrf drivers for nRF52 also. I tried the spi programs on both the DKs. Separately they are working properly. But when I try to read from nrf52 on nrf91, it shows error. So now I am switching to I2C. I2C communication is good between both the DKs. I can receive data from nrf52.&lt;/p&gt;
&lt;p&gt;But still curious why spi did not work together.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239291?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 10:07:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e97d4ed9-2f30-40c2-a2e4-74285ad27ba5</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;My mistake.&lt;br /&gt;Here is the&amp;nbsp;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/zephyr/reference/peripherals/spi.html?highlight=spi%20slave"&gt;SPI API Reference&lt;/a&gt; for the Zephyr SPI driver.&lt;br /&gt;Is this what you were looking for?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239278?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 09:16:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d98c66c-ca9b-4c74-9d0e-77d4267eef2e</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Actually I want to configure nRF9160DK as spi slave. So can you please provide the document for that. For nRF91 I am using zephyr spis driver.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between nRF9160DK and nRF52840DK</title><link>https://devzone.nordicsemi.com/thread/239275?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 09:07:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb8b7797-007d-486a-8110-e8a5c1347bb8</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Have you attempted to flash one of the devices with the&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/spi_slave_example.html"&gt; SPI Slave example&lt;/a&gt;, and the other with the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/spi_master_example.html"&gt;SPI Master example&lt;/a&gt; - and &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fspi_slave_example.html&amp;amp;anchor=spi_slave_example_testing"&gt;testing them according to their documentation&lt;/a&gt;?&lt;br /&gt;If you have not, please do it and let me know if you experience any unexpected results.&lt;br /&gt;&lt;br /&gt;Are you working out of an example provided in the SDK? If so, which one?&lt;br /&gt;Could you also tell me where the code snippet you provided is from, I am unable to recognize it.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]I am not understanding how to set these parameters to configure spi in slave and receive the data.[/quote]
&lt;p&gt;Have you seen the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__spis.html"&gt;SPIS API Reference&lt;/a&gt; or &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrfx__spi__config__t.html"&gt;Data Structure description&lt;/a&gt; in the SDK documentation?&lt;br /&gt;They detail the different options for each data structure and driver functions.&lt;br /&gt;You might also be interested in seeing &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/hardware_driver_spi_slave.html"&gt;this description&lt;/a&gt; of SPI Slave driver usage.&lt;br /&gt;&lt;br /&gt;Was this what you were looking for?&lt;/p&gt;
[quote user=""] but&amp;nbsp;spi_read shows error[/quote]
&lt;p&gt;Please detail what error it shows, and when it is encountered.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>