<?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>nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71449/nrf52832-and-rfm95</link><description>Good day, I have seen a few people asking about connecting the Nordic devices with the RFM95/Sx1276 modules. I understand that it is SPI driven, but I am a complete novice at this (moved recently from Arduino - to have access to the bigger ram and more</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Feb 2021 10:44:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71449/nrf52832-and-rfm95" /><item><title>RE: nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/thread/293935?ContentTypeID=1</link><pubDate>Thu, 11 Feb 2021 10:44:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f02c117f-20e6-41aa-b1d5-8988acf96d03</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The SPI Master driver supports two modes, blocking and non-blocking. In blocking mode, you do not pass any event handlers to the init-function, and the transfer functions will do a blocking wait internally until the transfer is completed. In non-blocking mode (which is used in the example), the transfer function simply starts a transfer and continues executing code, until it receives an end notification via the event handler that is provided during initialization. The example uses a flag (spi_xfer_done) to wait for the completion of the transfer, where the flag is set in the event handler.&lt;/p&gt;
&lt;p&gt;So you should either wait for the flag before starting a new transfer, like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx1_buf, sizeof(m_tx1_buf), NULL, 0))
 
while (!spi_xfer_done)
{
    __WFE();
}

APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_tx_buf)+sizeof(m_rx_buf)));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Or you can pass NULL to the event handler, to operate the driver in blocking mode:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, NULL, NULL));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Another option is to use the&amp;nbsp;&lt;a title="SPI transaction manager" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_nrf_spi_mngr.html?cp=7_1_3_50"&gt;SPI transaction manager&lt;/a&gt;&amp;nbsp;library, to schedule multiple background transfers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/thread/293863?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 19:44:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a10e999-83ce-4eaa-abc7-b4fbde1e5181</guid><dc:creator>dariusBotha</dc:creator><description>&lt;p&gt;Hello, I have one more question.&lt;br /&gt;&lt;br /&gt;Why would I get a fatal error when I try to do two transfers after one another? But if I put a 100ms delay it works fine. Is there a better way to do it?&lt;/p&gt;
&lt;p&gt;In my main code, I do the following: ( I also just have the standard&amp;nbsp;spi_event_handler()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx1_buf, sizeof(m_tx1_buf), NULL, 0))
 //nrf_delay_ms(1000);
 APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_tx_buf)+sizeof(m_rx_buf)));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your assistance so far&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/thread/293736?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 11:24:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1687d6c6-9b86-48f6-8a75-5d4971f538cc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Here are some examples of using the nrf_drv_spi_transfer() function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint8_t m_tx_buf[1] = 0xFF;
uint8_t m_rx_buf[3];

// Write 1 byte, receive 0 bytes
APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, sizeof(m_tx_buf), NULL, 0);

// Write 0 byte, receive 3 bytes
APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, NULL, 0, m_rx_buf, sizeof(m_rx_buf));

// Write 1 byte, then receive 3 bytes after write is done
APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_tx_buf) + sizeof(m_rx_buf)));&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/thread/293618?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 16:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79cacffb-bcf0-4e62-8cdd-0121e40afd91</guid><dc:creator>dariusBotha</dc:creator><description>&lt;p&gt;Wow, thank you. That makes so much more sense now!&lt;br /&gt;&lt;br /&gt;I will try and implement it. If it is possible could you also provide the example so I can compare and see how the correct/efficient way of programming it should look like?&lt;br /&gt;&lt;br /&gt;Really appreciate your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 and RFM95</title><link>https://devzone.nordicsemi.com/thread/293595?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 15:01:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27880749-f740-414c-8f85-005baaced008</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;SPI is a synchronous protocol supporting full duplex transfers. This means that data is clocked in on MISO (Master-Input, Slave-Output) pin at the same time as data is clocked out on MOSI (Master-Output, Slave-Input) pin. Using both TX and RX buffers allows you to easily check that the protocol works by connecting MOSI/MISO pins and verify that received data is equal to the transmitted data.&lt;/p&gt;
&lt;p&gt;As the API documentation for&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__drv__spi.html#ga8502179e5c7d7a7da5104a4c1febe1e0"&gt;nrf_drv_spi_transfer&lt;/a&gt;() mention, both buffer pointers can be NULL if there is no data to be transmitted/received.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To me, it sounds like the&amp;nbsp;NSS pin is just a normal SS/CSN pin for the SPI bus. The different modes are just determined by either the number of data bytes being transmitted in a single SPI transfer, or by the address (corresponding to FIFO or not). The address is typically the first byte in the SPI transfer, then follows one or more bytes for writing/reading the given address.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I do not have any experience with&amp;nbsp;RFM95/Sx1278, so I cannot help you there, but I can help you with the SPI peripheral and example if you are not able to read/write the registers in the device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>