<?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>nRF52 DK - SPI with PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94731/nrf52-dk---spi-with-ppi</link><description>Hello all, 
 I&amp;#39;m trying to send SPI signal from nRF52-DK to other circuit component. 
 nRF52 doesn&amp;#39;t receive data, and send 16 bit data at one transfer. 
 I want to send data every 20 us, so I wrote the code like this, using PPI. (This is not entire code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Dec 2022 21:26:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94731/nrf52-dk---spi-with-ppi" /><item><title>RE: nRF52 DK - SPI with PPI</title><link>https://devzone.nordicsemi.com/thread/400477?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 21:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8638f1ec-637f-4ade-b327-718e12cf0745</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Wow, your advice helped me a lot!&lt;/p&gt;
&lt;p&gt;Now it works. Thank you so much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK - SPI with PPI</title><link>https://devzone.nordicsemi.com/thread/400288?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 07:32:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6339225d-4622-431a-986f-278d27afe050</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see. You set up the transaction one time in your&amp;nbsp;DAC_init() where you call&amp;nbsp;nrf_drv_spi_xfer() with the&amp;nbsp;NRF_DRV_SPI_FLAG_HOLD_XFER flag. This will configure everything for a transaction that can be triggered by PPI, which it looks like you have done correctly. It will only happen once, though. To repeat it you need to set up a new transaction with&amp;nbsp;nrf_drv_spi_xfer() before triggering it with PPI again. I would suggest doing this in the SPI interrupt/event handler, so that you always set up a new transaction when the previous has completed.&lt;/p&gt;
&lt;p&gt;(It is also possible to set up several transactions in a row that can be triggered by PPI without CPU intervention using array list, which is described in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/87318/how-to-stop-spi-with-ppi-when-using-easydma-arraylist-feature"&gt;this thread&lt;/a&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK - SPI with PPI</title><link>https://devzone.nordicsemi.com/thread/400234?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 18:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d921780e-08ff-48a9-80f4-eedc35a873af</guid><dc:creator>juulee</dc:creator><description>&lt;p&gt;Hi, it was my mistake in the text, My target is 25us but actually it looks like 20us.&lt;br /&gt;I connected nRF52-DK with DAC, and I measured DAC output by oscilloscope.&lt;/p&gt;
&lt;p&gt;From oscilloscope, I could see that value is updated every ~20us (but not accurately 20us), and it maintained similar value although I changed &lt;span&gt;TIMER_DAC_TIMEOUT_US to 100 or 150.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think it is because of &amp;quot;nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, 0)&amp;quot; in spi_event_handler function. Because after spi transfer, event_handler is called and there is transfer function again, so this loop continues without PPI I guess...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But when I erase &amp;quot;nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, 0)&amp;quot; in spi_event_handler, I could not see any outputs (SPI transfer)...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK - SPI with PPI</title><link>https://devzone.nordicsemi.com/thread/400169?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 14:05:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:793243c4-1d81-43c9-8f99-d7b9b8f8eead</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see that in the code you have set&amp;nbsp;TIMER_DAC_TIMEOUT_US to 25 while in the text you write 20 us. Is that the issue? If not, can you elaborate on how the &amp;quot;time scale is not correct&amp;quot;? Please elaborate on your measurments and what you have found when debugging.&lt;/p&gt;
[quote user=""]I think PPI doesn&amp;#39;t work, maybe?[/quote]
&lt;p&gt;PPI itself should not fail as it is quite simple and the timer part of this triggering the SPI transfer for every compare0 event seems correct, so I would look elsewhere first.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>