<?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 master and DMA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25268/spi-master-and-dma</link><description>Using softdevice s132, nRF52832 on a custom board 
 I don&amp;#39;t quite understand how does the SPI work exactly? 
 I am using it on a battery powered low power sensor application, for this instance I have not set up a SPI event handler, but DMA is enabled</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Sep 2018 13:01:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25268/spi-master-and-dma" /><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/150270?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 13:01:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e09bdf3-1839-4439-a902-bf24c927054f</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately we don&amp;#39;t have any examples for SPIS with DMA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/150167?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 07:06:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b14ebf8-3c6e-42e6-afcb-80ffd689e47e</guid><dc:creator>PartTimeCode</dc:creator><description>&lt;p&gt;Hi, I am using SDK 15.0 with PCA10040 Board. I am trying to use DMA for SPI slave instance. Is there any example in SDK that can guide me to start? I found many examples of SPIM DMA and Arraylist but none on SPIS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99571?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2017 08:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38438f1b-c79f-443f-b41f-ea7baa685d18</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;Great, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99572?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2017 07:53:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1718dab7-b9f1-487f-8aad-b66fa035252f</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;You only need it if you want to do multiple transfers triggered on some sort of event and don&amp;#39;t want to use the CPU to set up each transfer. Such events can be generated by timers, external signals, etc. If you only need one transfer at the time I suggest that you just enable the event handler and let the CPU sleep until the event handler wakes it up after starting a transfer.&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t have any good examples in the SDK, but I posted an example in the comment section &lt;a href="https://devzone.nordicsemi.com/question/167599/why-is-not-my-timer-triggered-when-configured-through-ppi-and-spi/"&gt;here&lt;/a&gt; that might be useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99570?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2017 07:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:160e5d3f-3f1b-4e9d-ad43-9ff9c1aa57b8</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;So i need to set up PPI then? My app is built on ble nus peripheral example. Is there any tutorials to set up ppi for beginners?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99569?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2017 06:41:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:921eefd1-0f15-450f-97bb-f3facfde1545</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t use an event handler the SPI driver is waiting in a while() loop until the transfer is completed and you get an SPI transfer END event.&lt;/p&gt;
&lt;p&gt;In SDK 14 this happens at line 575 in nrf_drv_spi.c:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (!p_cb-&amp;gt;handler)
{
    while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){}
    if (p_cb-&amp;gt;ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
    {
        nrf_gpio_pin_set(p_cb-&amp;gt;ss_pin);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So yes, the CPU is waiting for the transfer to complete while wasting time and current. As you say, the point of DMA is to let the CPU sleep or do other things, but you are not actually using DMA if you don&amp;#39;t use the SPIM as explained in the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/hardware_driver_spi_master.html?cp=4_0_0_2_12_2#hardware_driver_spi_advanced"&gt;Advanced Usage&lt;/a&gt; section of the SPI driver documentation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99568?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2017 12:51:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d7d5be5-cc4d-4366-a61b-475d4a71953e</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;I am using the SPI Master driver from the NRF5 SDK (nrf_drv_spi.c?) So if I understand you right the CPU is busy clocking out the bytes on the SPI? I thought the point of DMA was to let the CPU sleep or do something else instead of driving the SPI bus on a much slower frequency?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI master and DMA</title><link>https://devzone.nordicsemi.com/thread/99567?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2017 12:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98e72c95-91ed-4e7a-8d7d-c17b0dd7b321</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Any particular reason why you don&amp;#39;t use SPI Master driver from nRF5 SKD? It shouldn&amp;#39;t have any flaws for battery powered app... also formulation &lt;em&gt;&amp;quot;what is the CPU doing while waiting for the SPI slave to clock in the bytes&amp;quot;&lt;/em&gt; doesn&amp;#39;t make sense because SPI Master is not waiting for anything normally, it must driver CLK signal so slave can output data on MISO line. If you have another (usually called &amp;quot;interrupt&amp;quot;) line from Slave to Master which signals that now Slave want&amp;#39;s to talk (so Master must provide CLK and listen on MISO) then simply put the MCU to POWER ON SLEEP and wait for GPIOTE interrupt...)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>