<?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>Multiple SPI commands in single transaction with CS toggle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126162/multiple-spi-commands-in-single-transaction-with-cs-toggle</link><description>New project using Nordic platform and I need to send multiple commands (32bit fixed size) to a device quickly using SPI with the CS toggling between each. I just want to confirm this is not something the nRF5340 can do, unlike various STM parts can? It</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Dec 2025 12:33:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126162/multiple-spi-commands-in-single-transaction-with-cs-toggle" /><item><title>RE: Multiple SPI commands in single transaction with CS toggle</title><link>https://devzone.nordicsemi.com/thread/557087?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2025 12:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45a20f33-84ab-46c6-b43f-14fd84b8510a</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, that understanding is correct. On the nRF5340, each SPI transfer results in a single CS assertion and de assertion, so it is not possible to generate multiple CS pulses within a single SPI transaction. For applications that require very tight timing between short transfers, the recommended approach is to use the nrfx SPIM API directly and trigger SPI transfers using hardware events (TIMER + DPPI) rather than starting each transfer from software. This can significantly reduces the inter-transfer gap and should work for transmit and receive. As a high level guide, you can proceed as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use the nrfx SPIM API (instead of the Zephyr SPI API)&lt;/li&gt;
&lt;li&gt;Configure a TIMER to generate an event at the required interval&lt;/li&gt;
&lt;li&gt;Prepare the SPI transfer using nrfx_spim_xfer() and set the NRFX_SPIM_FLAG_REPEATED_XFER flag.&lt;/li&gt;
&lt;li&gt;Obtain the SPIM START task address using nrfx_spim_start_task_address_get()&lt;/li&gt;
&lt;li&gt;Use DPPI to connect the TIMER event directly to the SPIM START task.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is the good resource for understanding timer to DPPI connections which shows how timer can toggle the GPIO, instead of toggling a gpio you would connect the timer event to the SPIM START task:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_gppi/one_to_one"&gt;timer toggling a GPIO&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And for&amp;nbsp;SPIM usage, this non-blocking nrfx example is a good reference:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_spim/non_blocking"&gt;non-blocking nrfx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also make sure you are using SPI master 4 (SPIM4) which supports hardware controlled CS and SPI frequencies up to 32 MHz.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>