<?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>Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60743/single-spi-transfer-from-ppi</link><description>I want to set up a SPI transfer so the transfer itself is triggered by PPI. The PPI is set up working, the chain of events is 
 
 Timer CC0 -&amp;gt; Set CS low 
 Timer CC1 -&amp;gt; Start SPI 
 SPI end -&amp;gt; Set CS high 
 
 Now, I want to send a packet of 2 bytes for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Apr 2020 16:28:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60743/single-spi-transfer-from-ppi" /><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/247158?ContentTypeID=1</link><pubDate>Tue, 28 Apr 2020 16:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:090ef619-8c1e-44e2-b352-fe7ff11816bd</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You&amp;#39;re right, I was getting an error. I was setting the PPI channel by&amp;nbsp;NRF_PPI-&amp;gt;CHENSET |= (1 &amp;lt;&amp;lt; ppi_cs_low) but using the driver to disable it (it was a quick test and late in the day!) which was returning unallocated channel errors.&lt;/p&gt;
&lt;p&gt;The good news is it works by enabling / disabling PPI so I can happily play 44.1kHz audio from a WAV file which is pretty impressive &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt; The bad news is it won&amp;#39;t work with BLE but that&amp;#39;s probably because my PPI is upsetting the Softdevice - tomorrow&amp;#39;s job is to rewrite the PPI stuff properly using the drivers.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Nick&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/246935?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 19:07:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d767c101-1fd1-426c-8d7c-6eed425fa780</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;How did you assign/enable the PPI channels? The functions should &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__ppi.html#ga6eab16754df257eba23dbe53a420a814"&gt;return an error code&lt;/a&gt; if the call is not successful, did you check that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/246928?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 18:05:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f826afe-919c-45b6-a8b8-f7c2cd194601</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;OK thanks, I&amp;#39;ll have to re-evaluate how I approach this then.&lt;/p&gt;
&lt;p&gt;Is there any reason why disabling the PPI channel didn&amp;#39;t work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/246925?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 17:39:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1afaa601-2641-4f48-b33d-2937b861015e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;nrfx_spim_xfer() will only setup the buffers for you when you add the&amp;nbsp;HOLD_XFER flag. There is nothing in the peripheral that clears the buffer pointers whenever the transfer is completed. If you want to stop transferring data when the ring buffer is empty, you need to stop the timer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/246908?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 14:41:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbdfa584-b275-4e70-9254-77d4d3455657</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Sorry for not being clear. At the moment for testing no I&amp;#39;m not updating dac_buf, I&amp;#39;m just doing the one-off xfer as part of main().&lt;/p&gt;
&lt;p&gt;In the real world, I&amp;#39;ll be feeding data&amp;nbsp;into a ring buffer, and taking them out 2 bytes at a time based on the timer event. So I&amp;#39;ll need the SPI to be transmitting when there is data and idle when the data has finished. Right now the SPI transmits all the time from the PPI.&lt;/p&gt;
&lt;p&gt;I could mess around with starting/stopping the timer or disabling the PPI event although I was hoping that the xfer would be a one-shot so I wouldn&amp;#39;t have to.&lt;/p&gt;
&lt;p&gt;Hope that makes it clearer...&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Nick&lt;/p&gt;
&lt;p&gt;Edit: I also added a spi event handler and included a couple of lines to disable the PPI channels but that didn&amp;#39;t work&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    nrfx_ppi_channel_disable(ppi_cs_low);
    nrfx_ppi_channel_disable(ppi_spi_start);
    nrfx_ppi_channel_disable(ppi_cs_hi);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Single SPI transfer from PPI</title><link>https://devzone.nordicsemi.com/thread/246869?ContentTypeID=1</link><pubDate>Mon, 27 Apr 2020 13:14:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef14953d-db60-4777-8d1a-20def89a5543</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure I understand your question. Do you update the&amp;nbsp;dac_buf somewhere, since you did not expect the same two bytes being sent every timer event?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>