<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>How to properly configure periodic SPI transfers with PPI and TIMER?</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/88962/how-to-properly-configure-periodic-spi-transfers-with-ppi-and-timer</link><description>I&amp;#39;m working on a BLE application based on the Zephyr RTOS. I need to read a SPI device at fixed time intervals and, as already suggested me here at point 3, I&amp;#39;m trying to implement a PPI channel that connects the TIMER0 event to the SPI task. I wrote</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 15 Jun 2022 13:28:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/88962/how-to-properly-configure-periodic-spi-transfers-with-ppi-and-timer" /><item><title>RE: How to properly configure periodic SPI transfers with PPI and TIMER?</title><link>https://test-devzone.nordicsemi.com/thread/372596?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 13:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a839484-da54-42a4-a7c0-0417dd87ca27</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The second argument to&amp;nbsp;&lt;span&gt;nrfx_timer_compare_event_address_get() should be the TIMER COMPARE channel, not the PPI channel (e.g. 0 for COMPARE0). Most likely, the variable&amp;nbsp;readingEventAddr does not contain the desired address after the function call (&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/timer.html#register.EVENTS_COMPARE-0-5"&gt;0x40008140&lt;/a&gt;), and the PPI channel will connect to something else.&lt;/span&gt;&lt;/p&gt;
[quote user=""]1) &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrfx/drivers/spim/driver.html#c.nrfx_spim_xfer"&gt;Here&lt;/a&gt;&amp;nbsp;it describes that if I wanto to use the&amp;nbsp;NRFX_SPIM_FLAG_HOLD_XFER flag I must to set the chip select pin as&amp;nbsp;NRFX_SPIM_PIN_NOT_USED&amp;nbsp;&lt;span&gt;and manage it outside the driver. How I should do it if the tranfers are supposed to be autonomous?&lt;/span&gt;[/quote]
&lt;p&gt;&lt;span&gt;If you have multiple SPI devices on the same bus, or need to control the CS line for power reasons, you can setup multiple COMPARE events to trigger after each other in the same timer, and use a second PPI channel together with GPIOTE to toggle the CS line before starting the SPI transfer. Similarly, you can toggle the GPIOTE channel when SPI END event is generated.&lt;/span&gt;&lt;/p&gt;
[quote user=""]&lt;span&gt;2) To generate the TIMER0 event in the PPI&amp;nbsp;can I set false the &lt;em&gt;enable_int&lt;/em&gt; parameter in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrfx/drivers/timer/driver.html#c.nrfx_timer_compare"&gt;nrfx_timer_compare&lt;/a&gt;&lt;/span&gt;&amp;nbsp;function or I have to set it as true? Because if I enable the interrupt, the Zephyr OS crash and restart the chip.[/quote]
&lt;p&gt;Yes, interrupt is not needed when using PPI. This is only used when you need the event to trigger an interrupt in SW.&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>